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