Support GRUB_DISABLE_SUBMENU config.
Inspired by patch from Prarit Bhargava.
This commit is contained in:
parent
5a01722ebc
commit
323de05ba2
8 changed files with 34 additions and 27 deletions
|
@ -1,3 +1,9 @@
|
|||
2013-11-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Support GRUB_DISABLE_SUBMENU config.
|
||||
|
||||
Inspired by patch from Prarit Bhargava.
|
||||
|
||||
2013-11-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* docs/grub.texi: Mention RSA support.
|
||||
|
|
|
@ -215,7 +215,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"
|
||||
|
|
|
@ -151,29 +151,29 @@ title_correction_code=
|
|||
# Extra indentation to add to menu entries in a submenu. We're not in a submenu
|
||||
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
|
||||
submenu_indentation=""
|
||||
is_first_entry=true
|
||||
is_top_level=true
|
||||
|
||||
while [ "x$kernels" != "x" ] ; do
|
||||
kernel=`version_find_latest $kernels`
|
||||
|
||||
if [ "x$is_first_entry" = xtrue ]; then
|
||||
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
|
||||
hurd_entry "$kernel" simple
|
||||
submenu_indentation="$grub_tab"
|
||||
|
||||
# TRANSLATORS: %s is replaced with an OS name
|
||||
echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnuhurd-advanced-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' {"
|
||||
is_top_level=false
|
||||
fi
|
||||
|
||||
hurd_entry "$kernel" advanced
|
||||
hurd_entry "$kernel" recovery
|
||||
|
||||
kernels=`echo $kernels | tr ' ' '\n' | grep -vx $kernel | tr '\n' ' '`
|
||||
is_first_entry=false
|
||||
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
|
||||
if [ x"$is_top_level" != xtrue ]; then
|
||||
echo '}'
|
||||
fi
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ title_correction_code=
|
|||
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
|
||||
submenu_indentation=""
|
||||
|
||||
is_first_entry=true
|
||||
is_top_level=true
|
||||
|
||||
while [ "x$list" != "x" ] ; do
|
||||
kfreebsd=`version_find_latest $list`
|
||||
|
@ -211,7 +211,7 @@ while [ "x$list" != "x" ] ; do
|
|||
module_dir_rel=$(make_system_path_relative_to_its_root $module_dir)
|
||||
fi
|
||||
|
||||
if [ "x$is_first_entry" = xtrue ]; then
|
||||
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
|
||||
kfreebsd_entry "${OS}" "${version}" simple
|
||||
submenu_indentation="$grub_tab"
|
||||
|
||||
|
@ -220,6 +220,7 @@ while [ "x$list" != "x" ] ; do
|
|||
fi
|
||||
# TRANSLATORS: %s is replaced with an OS name
|
||||
echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'kfreebsd-advanced-$boot_device_id' {"
|
||||
is_top_level=false
|
||||
fi
|
||||
|
||||
kfreebsd_entry "${OS}" "${version}" advanced
|
||||
|
@ -228,12 +229,11 @@ while [ "x$list" != "x" ] ; do
|
|||
fi
|
||||
|
||||
list=`echo $list | tr ' ' '\n' | grep -vx $kfreebsd | tr '\n' ' '`
|
||||
is_first_entry=false
|
||||
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
|
||||
if [ x"$is_top_level" != xtrue ]; then
|
||||
echo '}'
|
||||
fi
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ title_correction_code=
|
|||
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
|
||||
submenu_indentation=""
|
||||
|
||||
is_first_entry=true
|
||||
is_top_level=true
|
||||
while [ "x$list" != "x" ] ; do
|
||||
linux=`version_find_latest $list`
|
||||
gettext_printf "Found linux image: %s\n" "$linux" >&2
|
||||
|
@ -226,7 +226,7 @@ while [ "x$list" != "x" ] ; do
|
|||
linux_root_device_thisversion=${GRUB_DEVICE}
|
||||
fi
|
||||
|
||||
if [ "x$is_first_entry" = xtrue ]; then
|
||||
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
|
||||
linux_entry "${OS}" "${version}" simple \
|
||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
||||
|
||||
|
@ -237,6 +237,7 @@ while [ "x$list" != "x" ] ; do
|
|||
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' {"
|
||||
is_top_level=false
|
||||
fi
|
||||
|
||||
linux_entry "${OS}" "${version}" advanced \
|
||||
|
@ -247,12 +248,11 @@ while [ "x$list" != "x" ] ; do
|
|||
fi
|
||||
|
||||
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
|
||||
is_first_entry=false
|
||||
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
|
||||
if [ x"$is_top_level" != xtrue ]; then
|
||||
echo '}'
|
||||
fi
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ pattern="^ELF[^,]*executable.*statically linked"
|
|||
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
|
||||
submenu_indentation=""
|
||||
|
||||
is_first_entry=true
|
||||
is_top_level=true
|
||||
for k in /netbsd $(ls -t /netbsd?* 2>/dev/null) ; do
|
||||
if ! grub_file_is_not_garbage "$k" ; then
|
||||
continue
|
||||
|
@ -157,7 +157,7 @@ for k in /netbsd $(ls -t /netbsd?* 2>/dev/null) ; do
|
|||
|
||||
gettext_printf "Found NetBSD kernel: %s\n" "$k" >&2
|
||||
|
||||
if [ "x$is_first_entry" = xtrue ]; then
|
||||
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
|
||||
netbsd_entry "knetbsd" "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAULT}"
|
||||
submenu_indentation="$grub_tab"
|
||||
|
||||
|
@ -166,6 +166,7 @@ for k in /netbsd $(ls -t /netbsd?* 2>/dev/null) ; do
|
|||
fi
|
||||
# TRANSLATORS: %s is replaced with an OS name
|
||||
echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'netbsd-advanced-$boot_device_id' {"
|
||||
is_top_level=false
|
||||
fi
|
||||
|
||||
netbsd_entry "knetbsd" "$k" advanced "${GRUB_CMDLINE_NETBSD_DEFAULT}"
|
||||
|
@ -174,12 +175,11 @@ for k in /netbsd $(ls -t /netbsd?* 2>/dev/null) ; do
|
|||
netbsd_entry "knetbsd" "$k" recovery "-s"
|
||||
netbsd_entry "multiboot" "$k" recovery "-s"
|
||||
fi
|
||||
is_first_entry=false
|
||||
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
|
||||
if [ x"$is_top_level" != xtrue ]; then
|
||||
echo '}'
|
||||
fi
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ esac
|
|||
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
|
||||
submenu_indentation=""
|
||||
|
||||
is_first_entry=true
|
||||
is_top_level=true
|
||||
|
||||
while [ "x${xen_list}" != "x" ] ; do
|
||||
list="${linux_list}"
|
||||
|
@ -205,7 +205,7 @@ while [ "x${xen_list}" != "x" ] ; do
|
|||
if [ -z "$boot_device_id" ]; then
|
||||
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
|
||||
fi
|
||||
if [ "x$is_first_entry" != xtrue ]; then
|
||||
if [ "x$is_top_level" != xtrue ]; then
|
||||
echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
|
||||
fi
|
||||
while [ "x$list" != "x" ] ; do
|
||||
|
@ -239,7 +239,7 @@ while [ "x${xen_list}" != "x" ] ; do
|
|||
linux_root_device_thisversion=${GRUB_DEVICE}
|
||||
fi
|
||||
|
||||
if [ "x$is_first_entry" = xtrue ]; then
|
||||
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
|
||||
linux_entry "${OS}" "${version}" "${xen_version}" simple \
|
||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
|
||||
|
||||
|
@ -251,8 +251,8 @@ while [ "x${xen_list}" != "x" ] ; do
|
|||
# TRANSLATORS: %s is replaced with an OS name
|
||||
echo "submenu '$(gettext_printf "Advanced options for %s (with Xen hypervisor)" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
|
||||
echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
|
||||
is_top_level=false
|
||||
fi
|
||||
is_first_entry=false
|
||||
|
||||
linux_entry "${OS}" "${version}" "${xen_version}" advanced \
|
||||
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
|
||||
|
@ -263,7 +263,7 @@ while [ "x${xen_list}" != "x" ] ; do
|
|||
|
||||
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
|
||||
done
|
||||
if [ x"$is_first_entry" != xtrue ]; then
|
||||
if [ x"$is_top_level" != xtrue ]; then
|
||||
echo ' }'
|
||||
fi
|
||||
xen_list=`echo $xen_list | tr ' ' '\n' | grep -vx $current_xen | tr '\n' ' '`
|
||||
|
@ -271,7 +271,7 @@ 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
|
||||
if [ x"$is_top_level" != xtrue ]; then
|
||||
echo '}'
|
||||
fi
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ EOF
|
|||
fi
|
||||
prepare_boot_cache=
|
||||
boot_device_id=
|
||||
is_first_entry=true
|
||||
is_top_level=true
|
||||
title_correction_code=
|
||||
OS="${LONGNAME}"
|
||||
|
||||
|
@ -215,7 +215,7 @@ EOF
|
|||
prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | grub_add_tab)"
|
||||
fi
|
||||
|
||||
if [ "x$is_first_entry" = xtrue ]; then
|
||||
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
|
||||
cat << EOF
|
||||
menuentry '$(echo "$OS $onstr" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
|
||||
EOF
|
||||
|
@ -233,7 +233,7 @@ EOF
|
|||
}
|
||||
EOF
|
||||
echo "submenu '$(gettext_printf "Advanced options for %s" "${OS} $onstr" | grub_quote)' \$menuentry_id_option 'osprober-gnulinux-advanced-$boot_device_id' {"
|
||||
is_first_entry=false
|
||||
is_top_level=false
|
||||
fi
|
||||
title="${LLABEL} $onstr"
|
||||
cat << EOF
|
||||
|
@ -259,7 +259,7 @@ EOF
|
|||
grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
|
||||
fi
|
||||
done
|
||||
if [ x"$is_first_entry" != xtrue ]; then
|
||||
if [ x"$is_top_level" != xtrue ]; then
|
||||
echo '}'
|
||||
fi
|
||||
echo "$title_correction_code"
|
||||
|
|
Loading…
Reference in a new issue