Blame SOURCES/0459-add-GRUB_DISABLE_SUBMENU-option.patch

f96e0b
From 08d16ac5e3849e2c0b73aa57adc745dbc3a73aad Mon Sep 17 00:00:00 2001
f96e0b
From: Prarit Bhargava <prarit@redhat.com>
f96e0b
Date: Thu, 7 Feb 2013 11:53:41 -0500
f96e0b
Subject: [PATCH 459/482] add GRUB_DISABLE_SUBMENU option
f96e0b
f96e0b
This patch adds the ability to disable the grub2 submenus from
f96e0b
/etc/default/grub
f96e0b
f96e0b
To disable the submenus
f96e0b
f96e0b
echo 'GRUB_DISABLE_SUBMENU="true"' >> /etc/default/grub
f96e0b
---
f96e0b
 util/grub-mkconfig.in   |  3 ++-
f96e0b
 util/grub.d/10_linux.in | 24 ++++++++++++++----------
f96e0b
 2 files changed, 16 insertions(+), 11 deletions(-)
f96e0b
f96e0b
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
f96e0b
index 8decc1d..ea42cab 100644
f96e0b
--- a/util/grub-mkconfig.in
f96e0b
+++ b/util/grub-mkconfig.in
f96e0b
@@ -215,7 +215,8 @@ export GRUB_DEFAULT \
f96e0b
   GRUB_INIT_TUNE \
f96e0b
   GRUB_SAVEDEFAULT \
f96e0b
   GRUB_ENABLE_CRYPTODISK \
f96e0b
-  GRUB_BADRAM
f96e0b
+  GRUB_BADRAM \
f96e0b
+  GRUB_DISABLE_SUBMENU
f96e0b
 
f96e0b
 if test "x${grub_cfg}" != "x"; then
f96e0b
   rm -f "${grub_cfg}.new"
f96e0b
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
f96e0b
index 4807d84..d7ea670 100644
f96e0b
--- a/util/grub.d/10_linux.in
f96e0b
+++ b/util/grub.d/10_linux.in
f96e0b
@@ -240,17 +240,19 @@ while [ "x$list" != "x" ] ; do
f96e0b
     linux_root_device_thisversion=${GRUB_DEVICE}
f96e0b
   fi
f96e0b
 
f96e0b
-  if [ "x$is_first_entry" = xtrue ]; then
f96e0b
-    linux_entry "${OS}" "${version}" simple \
f96e0b
-    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
f96e0b
+  if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then
f96e0b
+    if [ "x$is_first_entry" = xtrue ]; then
f96e0b
+      linux_entry "${OS}" "${version}" simple \
f96e0b
+      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
f96e0b
 
f96e0b
-    submenu_indentation="$grub_tab"
f96e0b
+      submenu_indentation="$grub_tab"
f96e0b
     
f96e0b
-    if [ -z "$boot_device_id" ]; then
f96e0b
-	boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
f96e0b
+      if [ -z "$boot_device_id" ]; then
f96e0b
+	  boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
f96e0b
+      fi
f96e0b
+      # TRANSLATORS: %s is replaced with an OS name
f96e0b
+      echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
f96e0b
     fi
f96e0b
-    # TRANSLATORS: %s is replaced with an OS name
f96e0b
-    echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
f96e0b
   fi
f96e0b
 
f96e0b
   linux_entry "${OS}" "${version}" advanced \
f96e0b
@@ -266,8 +268,10 @@ done
f96e0b
 
f96e0b
 # If at least one kernel was found, then we need to
f96e0b
 # add a closing '}' for the submenu command.
f96e0b
-if [ x"$is_first_entry" != xtrue ]; then
f96e0b
-  echo '}'
f96e0b
+if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then
f96e0b
+  if [ x"$is_first_entry" != xtrue ]; then
f96e0b
+    echo '}'
f96e0b
+  fi
f96e0b
 fi
f96e0b
 
f96e0b
 echo "$title_correction_code"
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b