dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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