konradr / rpms / grub2

Forked from rpms/grub2 6 years ago
Clone
Blob Blame History Raw
From ec4b06bcd18d2df965df4a8d53c44ed034cd2d21 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <matthew.garrett@nebula.com>
Date: Wed, 12 Jun 2013 11:51:49 -0400
Subject: [PATCH 479/482] Add support for UEFI operating systems returned by
 os-prober

os-prober returns UEFI operating systems in the form:

path:long-name:name

where path is the path under the EFI directory on the ESP. This is in
contrast to legacy OSes, where path is the device string. Handle this case.
---
 util/grub.d/30_os-prober.in | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 04f32a1..f8ae241 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -274,9 +274,23 @@ EOF
 EOF
     ;;
     *)
-      echo -n "  "
-      # TRANSLATORS: %s is replaced by OS name.
-      gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2
-    ;;
+      case ${DEVICE} in
+	*.efi)
+	  cat << EOF
+menuentry '$(echo "${LONGNAME}" | grub_quote)' {
+EOF
+	  save_default_entry | grub_add_tab
+	  cat << EOF
+	  chainloader /EFI/${DEVICE}
+	  boot
+}
+EOF
+	  ;;
+	*)
+          echo -n "  "
+          # TRANSLATORS: %s is replaced by OS name.
+          gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2
+        ;;
+      esac
   esac
 done
-- 
1.8.2.1