grub2/grub-2.00-add-GRUB-DISABLE-SUBMENU-option.patch

81 lines
2.5 KiB
Diff
Raw Normal View History

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