From: Michael Prokop Date: Wed, 6 Sep 2017 07:20:08 +0000 (+0200) Subject: Secure Boot GRUB template: be more dynamic + don't overwrite with empty variable X-Git-Tag: v0.31.0~2 X-Git-Url: https://git.grml.org/?p=grml-live.git;a=commitdiff_plain;h=4b8bb306125118065d3b0845aadffc0407b68312;hp=c965d94764064a8098d99558b9d0085dda629d58 Secure Boot GRUB template: be more dynamic + don't overwrite with empty variable By searching for grmlenv.cfg we can make it more dynamic instead of having to hardcode (hd0) which might be wrong in the grml2usb situation. There's also no need to set root/prefix multiple times, especially since we depend on 'root=(hd0)' for the default ISO boot anyway. Don't overwrite prefix if the grml_orig_prefix variable is empty. Secure Boot enabled ISOs generated with grml-live >=0.31.0 are supported with grml2usb >=0.16.0. --- diff --git a/templates/secureboot/grub.cfg b/templates/secureboot/grub.cfg index b378aab..b5010f3 100644 --- a/templates/secureboot/grub.cfg +++ b/templates/secureboot/grub.cfg @@ -3,26 +3,24 @@ export grml_orig_prefix set grml_orig_root=$root export grml_orig_root -set prefix=(hd0)/boot/grub/ -set root=(hd0) -source (hd0)/boot/grub/grmlenv.cfg -set prefix=(hd0)/boot/grub/ +search.file /boot/grub/grmlenv.cfg root +set prefix=($root)/boot/grub/ +source ($root)/boot/grub/grmlenv.cfg if [ "$grml_secureboot" = false ] ; then - set root=(hd0) configfile /boot/grub/grub.cfg + # if that fails we need to fallback, but how? else - set prefix=$grml_orig_prefix - set root=$grml_orig_root - - set timeout=20 - set root=(hd0) + if [ "$grml_orig_prefix" != "" ] ; then + set prefix=$grml_orig_prefix + fi # this is basically a copy of templates/boot/grub/header.cfg but to avoid # failures due to Secure Boot restrictions and sourcing addons.cfg via # /boot/grub/loopback.cfg (and then showing entries that are at the wrong # position as well as don't work at all) we have to specify the appropriate # config here + set timeout=20 if loadfont /boot/grub/ascii.pf2 ; then set gfxmode=auto insmod efi_gop