dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0112-Add-support-for-UEFI-operating-systems-returned-by-o.patch

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
606ea6
From: Matthew Garrett <matthew.garrett@nebula.com>
606ea6
Date: Wed, 12 Jun 2013 11:51:49 -0400
28f7f8
Subject: [PATCH] Add support for UEFI operating systems returned by os-prober
606ea6
606ea6
os-prober returns UEFI operating systems in the form:
606ea6
606ea6
path:long-name:name
606ea6
606ea6
where path is the path under the EFI directory on the ESP. This is in
606ea6
contrast to legacy OSes, where path is the device string. Handle this case.
606ea6
---
606ea6
 util/grub.d/30_os-prober.in | 22 ++++++++++++++++++----
606ea6
 1 file changed, 18 insertions(+), 4 deletions(-)
606ea6
606ea6
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
28f7f8
index 6f38c82a554..9f955abb788 100644
606ea6
--- a/util/grub.d/30_os-prober.in
606ea6
+++ b/util/grub.d/30_os-prober.in
39700a
@@ -322,9 +322,23 @@ EOF
606ea6
 EOF
606ea6
     ;;
606ea6
     *)
606ea6
-      echo -n "  "
606ea6
-      # TRANSLATORS: %s is replaced by OS name.
606ea6
-      gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2
606ea6
-    ;;
606ea6
+      case ${DEVICE} in
606ea6
+	*.efi)
606ea6
+	  cat << EOF
606ea6
+menuentry '$(echo "${LONGNAME}" | grub_quote)' {
606ea6
+EOF
606ea6
+	  save_default_entry | grub_add_tab
606ea6
+	  cat << EOF
606ea6
+	  chainloader /EFI/${DEVICE}
606ea6
+	  boot
606ea6
+}
606ea6
+EOF
606ea6
+	  ;;
606ea6
+	*)
606ea6
+          echo -n "  "
606ea6
+          # TRANSLATORS: %s is replaced by OS name.
606ea6
+          gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2
606ea6
+        ;;
606ea6
+      esac
606ea6
   esac
606ea6
 done