Blame SOURCES/0146-Only-attempt-to-query-dev-mounted-in-boot-efi-as-boo.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Javier Martinez Canillas <javierm@redhat.com>
8631a2
Date: Tue, 24 Apr 2018 02:16:38 +0200
8631a2
Subject: [PATCH] Only attempt to query dev mounted in /boot/efi as boot dev on
8631a2
 EFI machines
8631a2
8631a2
The 10_linux script calls grub2-probe to probe the information for the dev
8631a2
mounted in /boot/efi, but this directory may not exist on non-EFI machines
8631a2
which leads to the following error when generating the grub2 config file:
8631a2
8631a2
/usr/sbin/grub2-probe: error: failed to get canonical path of `/boot/efi/'
8631a2
8631a2
Instead query for the device mounted in /boot and use that as the boot dev
8631a2
for non-EFI machines.
8631a2
8631a2
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
8631a2
---
8631a2
 util/grub.d/10_linux.in | 9 +++++++--
8631a2
 1 file changed, 7 insertions(+), 2 deletions(-)
8631a2
8631a2
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
b32e65
index 89cd71d85..61d0664fb 100644
8631a2
--- a/util/grub.d/10_linux.in
8631a2
+++ b/util/grub.d/10_linux.in
8631a2
@@ -133,8 +133,13 @@ linux_entry ()
8631a2
       fi
8631a2
     fi
8631a2
 
8631a2
-    bootefi_device="`${grub_probe} --target=device /boot/efi/`"
8631a2
-    prepare_grub_to_access_device ${bootefi_device} boot
8631a2
+    if [ -d /sys/firmware/efi ]; then
8631a2
+        bootefi_device="`${grub_probe} --target=device /boot/efi/`"
8631a2
+        prepare_grub_to_access_device ${bootefi_device} boot
8631a2
+    else
8631a2
+        boot_device="`${grub_probe} --target=device /boot/`"
8631a2
+        prepare_grub_to_access_device ${boot_device} boot
8631a2
+    fi
8631a2
 
8631a2
     cat << EOF
8631a2
 insmod blscfg