Here are my updated patches. > On 20.07.2011 14:27, devkral wrote: > > Hello, > > the scripts to generate a grub.cfg file doesn't find lvm under encrypted > > partitions (arch). > > Debian has fixed this problem elsewise but it would be nice to have a clean > > way detecting such partitions. > > I attach a patch to do so with an alternative /etc/grub.d/10_linux file > > (cryptgrub2.patch). > > > Could you update it to use grub-probe as it now has LUKS support? > > Cryptswapgrub2.patch includes also a fix > > for hibernation support with encrypted swap-partitions (it includes > > every swap device in fstab invoked by the "resume=" command in the kernel > > argument list, > > so I'm not sure if this hasn't annoying consequences). > > > > Regards, > > Alex > > > > > > > > _______________________________________________ > > Bug-grub mailing list > > Bug-grub@gnu.org > > https://lists.gnu.org/mailman/listinfo/bug-grub > >
--- 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 ...")"
--- a/etc/grub.d/10_linux +++ b/etc/grub.d/10_linux @@ -60,11 +60,40 @@ 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 +} + +swapresumedetect() +{ + swapdev="" + local swapdev_tmp=$(grep "swap" /etc/fstab | sed -e "s/ [^ ]\+//g" -e "s/ //g";) + if [ swapdev_tmp ] + then + swapdev="resume=$(echo $swapdev_tmp | sed "s/ / resume=/g")" + fi +} + + linux_entry () { os="$1" version="$2" recovery="$3" + cryptdetect + swapresumedetect args="$4" if [ -n "$5" ] ; then title="$(gettext_quoted "%s, with Linux %s") $5" @@ -119,7 +148,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} ${swapdev} root=${linux_root_device_thisversion} ro ${args} EOF if test -n "${initrd}" ; then message="$(gettext_printf "Loading initial ramdisk ...")"
_______________________________________________ Bug-grub mailing list Bug-grub@gnu.org https://lists.gnu.org/mailman/listinfo/bug-grub