--- a/etc/grub.d/10_linux +++ b/etc/grub.d/10_linux @@ -60,11 +60,30 @@ fi fi +cryptdetect () +{ +#check if luks + if grub-probe -t abstraction -d ${LINUX_ROOT_DEVICE} | grep "luks" > /dev/null + then +#check if lvm + lvmname="" + if grub-probe -t abstraction -d ${LINUX_ROOT_DEVICE} | grep "lvm" > /dev/null; then + lvmname=":$(dmsetup --noheadings info -c -o vg_name ${LINUX_ROOT_DEVICE})" + fi +#format then insert + cryptdevice_check=$(grub-probe -t cryptodisk_uuid -d ${LINUX_ROOT_DEVICE} | fold -w 4) + cryptdevice_tmp="cryptdevice=/dev/disk/by-uuid/$(echo ${cryptdevice_check} | sed -e "s/ //" -e "s/ /-/" -e "s/ /-/" -e "s/ /-/" -e "s/ /-/" -e "s/ //" -e "s/ //")${lvmname}" + fi +} + + + linux_entry () { os="$1" version="$2" recovery="$3" + cryptdetect args="$4" if [ -n "$5" ] ; then title="$(gettext_quoted "%s, with Linux %s") $5" @@ -119,7 +138,7 @@ message="$(gettext_printf "Loading Linux %s ..." ${version})" cat << EOF echo '$message' - linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} + linux ${rel_dirname}/${basename} ${cryptdevice_tmp} root=${linux_root_device_thisversion} ro ${args} EOF if test -n "${initrd}" ; then message="$(gettext_printf "Loading initial ramdisk ...")"