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
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue