Merge remote-tracking branch 'origin/pr/174'
authorMichael Prokop <mika@grml.org>
Mon, 31 May 2021 07:23:36 +0000 (09:23 +0200)
committerMichael Prokop <mika@grml.org>
Mon, 31 May 2021 07:23:36 +0000 (09:23 +0200)
chroot-script
grml-debootstrap

index b0737ca..8104df1 100755 (executable)
@@ -595,8 +595,18 @@ efi_setup() {
   echo "Mounting $EFI on /boot/efi"
   mount "$EFI" /boot/efi || return 1
 
+  # if efivarfs kernel module is loaded, but efivars isn't,
+  # then we need to mount efivarfs for efibootmgr usage
+  if ! ls /sys/firmware/efi/efivars/* &>/dev/null ; then
+    echo "Mounting efivarfs on /sys/firmware/efi/efivars"
+    mount -t efivarfs efivarfs /sys/firmware/efi/efivars
+  fi
+
   echo "Invoking efibootmgr"
   efibootmgr || return 1
+
+  umount /sys/firmware/efi/efivars &>/dev/null || true
+
 }
 
 # grub configuration/installation {{{
index 6c0d625..52d428f 100755 (executable)
@@ -996,9 +996,14 @@ format_efi_partition() {
 # check for EFI support or try to enable it {{{
 efi_support() {
   local efivars_loaded=false
+  # this is for kernels versions before v3.10, which didn't provide efivarfs yet
   if modprobe efivars &>/dev/null ; then
     efivars_loaded=true
   fi
+  # kernel versions v3.10 and newer usually provide efivarfs
+  if modprobe efivarfs &>/dev/null ; then
+    efivars_loaded=true
+  fi
 
   if [ -d /sys/firmware/efi ] ; then
     einfo "EFI support detected." ; eend 0