Refresh Secure Boot support, supporting new 'debian' method
[grml-live.git] / templates / secureboot / grub.cfg
1 # Secure Boot support
2 # We are supposed to end up in this file only when running with enabled Secure Boot
3
4 set grml_orig_prefix=$prefix
5 export grml_orig_prefix
6 set grml_orig_root=$root
7 export grml_orig_root
8
9 search.file %BOOT_FILE% root
10 set prefix=($root)/boot/grub/
11
12 # this is a simple test to identify whether GRUB is running in Secure Boot mode
13 # or not; "wrmsr" is in the list of disabled_mods of GRUB and is supposed to be
14 # invoked with two arguments (and if not fails with exit code 18), but when
15 # running under Secure Boot it fails with: "error: Secure Boot forbits loading
16 # module from [...]/boot/grub/x86_64-efi/wrmsr.mod" + returns with exit code 30
17 wrmsr
18 if [ $? = 30 ] ; then
19   echo "It looks like Secure Boot is enabled."
20   set grml_secureboot=true
21   export grml_secureboot
22 else
23   echo "It looks like Secure Boot is NOT enabled."
24   set grml_secureboot=false
25   export grml_secureboot
26 fi
27
28 if [ -e /boot/grub/grub.cfg ] ; then
29   configfile /boot/grub/grub.cfg
30 else
31   echo "ERROR: It looks like SecureBoot is enabled but reading GRUB configuration failed.
32
33 Please execute the following commands and provide the output to the Grml team:
34
35 echo \$prefix
36 echo \$root
37 echo \$grml_orig_prefix
38 echo \$grml_orig_root
39 search.file /boot/grub/grub.cfg
40
41 Hint: Create a screenshot or a picture with your digital camera or mobile phone."
42
43 fi