]>
Commit | Line | Data |
---|---|---|
50fb4025 JR |
1 | From 81e46875469ae8b2a803e6457784801a0a7a7963 Mon Sep 17 00:00:00 2001 |
2 | From: Prarit Bhargava <prarit@redhat.com> | |
3 | Date: Thu, 7 Feb 2013 11:53:41 -0500 | |
4 | Subject: [PATCH] add GRUB_DISABLE_SUBMENU option | |
5 | ||
6 | This patch adds the ability to disable the grub2 submenus from | |
7 | /etc/default/grub | |
8 | ||
9 | To disable the submenus | |
10 | ||
11 | echo 'GRUB_DISABLE_SUBMENU="true"' >> /etc/default/grub | |
12 | ||
13 | ||
14 | --- | |
15 | util/grub-mkconfig.in | 3 ++- | |
16 | util/grub.d/10_linux.in | 24 ++++++++++++++---------- | |
17 | 2 files changed, 16 insertions(+), 11 deletions(-) | |
18 | ||
19 | diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in | |
20 | index 516be86..354eb43 100644 | |
21 | --- a/util/grub-mkconfig.in | |
22 | +++ b/util/grub-mkconfig.in | |
23 | @@ -216,7 +216,8 @@ export GRUB_DEFAULT \ | |
24 | GRUB_INIT_TUNE \ | |
25 | GRUB_SAVEDEFAULT \ | |
26 | GRUB_ENABLE_CRYPTODISK \ | |
27 | - GRUB_BADRAM | |
28 | + GRUB_BADRAM \ | |
29 | + GRUB_DISABLE_SUBMENU | |
30 | ||
31 | if test "x${grub_cfg}" != "x"; then | |
32 | rm -f "${grub_cfg}.new" | |
33 | diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in | |
34 | index e2b8ab3..9427a39 100644 | |
35 | --- a/util/grub.d/10_linux.in | |
36 | +++ b/util/grub.d/10_linux.in | |
37 | @@ -240,17 +240,19 @@ while [ "x$list" != "x" ] ; do | |
38 | linux_root_device_thisversion=${GRUB_DEVICE} | |
39 | fi | |
40 | ||
41 | - if [ "x$is_first_entry" = xtrue ]; then | |
42 | - linux_entry "${OS}" "${version}" simple \ | |
43 | - "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" | |
6496132c | 44 | + if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then |
50fb4025 JR |
45 | + if [ "x$is_first_entry" = xtrue ]; then |
46 | + linux_entry "${OS}" "${version}" simple \ | |
47 | + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" | |
48 | ||
49 | - submenu_indentation="\t" | |
50 | + submenu_indentation="\t" | |
51 | ||
52 | - if [ -z "$boot_device_id" ]; then | |
53 | - boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" | |
54 | + if [ -z "$boot_device_id" ]; then | |
55 | + boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" | |
56 | + fi | |
57 | + # TRANSLATORS: %s is replaced with an OS name | |
58 | + echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" | |
59 | fi | |
60 | - # TRANSLATORS: %s is replaced with an OS name | |
61 | - echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" | |
62 | fi | |
63 | ||
64 | linux_entry "${OS}" "${version}" advanced \ | |
65 | @@ -266,8 +268,10 @@ done | |
66 | ||
67 | # If at least one kernel was found, then we need to | |
68 | # add a closing '}' for the submenu command. | |
69 | -if [ x"$is_first_entry" != xtrue ]; then | |
70 | - echo '}' | |
6496132c | 71 | +if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then |
50fb4025 JR |
72 | + if [ x"$is_first_entry" != xtrue ]; then |
73 | + echo '}' | |
74 | + fi | |
75 | fi | |
76 | ||
77 | echo "$title_correction_code" | |
78 | --- grub-2.00/util/grub.d/20_linux_xen.in~ 2013-04-15 00:03:09.162253769 +0200 | |
79 | +++ grub-2.00/util/grub.d/20_linux_xen.in 2013-04-15 00:18:49.254774567 +0200 | |
80 | @@ -232,7 +232,8 @@ | |
81 | linux_root_device_thisversion=${GRUB_DEVICE} | |
82 | fi | |
83 | ||
84 | - if [ "x$is_first_entry" = xtrue ]; then | |
6496132c | 85 | + if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then |
50fb4025 JR |
86 | + if [ "x$is_first_entry" = xtrue ]; then |
87 | linux_entry "${OS}" "${version}" "${xen_version}" simple \ | |
88 | "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" | |
89 | ||
90 | @@ -243,9 +244,10 @@ | |
91 | fi | |
92 | # TRANSLATORS: %s is replaced with an OS name | |
93 | echo "submenu '$(gettext_printf "Advanced options for %s (with Xen hypervisor)" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" | |
94 | - echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" | |
95 | + echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" | |
96 | + fi | |
97 | + is_first_entry=false | |
98 | fi | |
99 | - is_first_entry=false | |
100 | ||
101 | linux_entry "${OS}" "${version}" "${xen_version}" advanced \ | |
102 | "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" | |
103 | @@ -256,8 +258,10 @@ | |
104 | ||
105 | list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` | |
106 | done | |
107 | - if [ x"$is_first_entry" != xtrue ]; then | |
6496132c | 108 | + if [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then |
50fb4025 JR |
109 | + if [ x"$is_first_entry" != xtrue ]; then |
110 | echo ' }' | |
111 | + fi | |
112 | fi | |
113 | xen_list=`echo $xen_list | tr ' ' '\n' | grep -vx $current_xen | tr '\n' ' '` | |
114 | done |