From: Jordan Uggla <jordan.uggla@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH] Use submenus for 10_linux
Date: Wed, 24 Nov 2010 18:54:03 -0800 [thread overview]
Message-ID: <4CEDCFCB.3090003@gmail.com> (raw)
In-Reply-To: <20101124172029.GN21862@riva.ucam.org>
[-- Attachment #1: Type: text/plain, Size: 988 bytes --]
On 11/24/2010 09:21 AM, Colin Watson wrote:
> What do people think of this? It's a remarkably small change now that
> Vladimir's implemented submenus, and I've had a number of requests for
> it.
<snip>
> * util/grub.d/10_linux.in: Put second and subsequent menu entries in
> a submenu.
<snip>
> + echo "submenu \"Previous Linux versions\" {"
Since most users don't need to know what kernel version is being used by
default, I think we should simplify the title of the default menu entry
(by removing the "with Linux ...") and have a submenu labeled "Advanced
options for $OS". This submenu would include all kernel entries,
including the first entry (which would also be booted if you just
selected the main entry instead of going to the submenu). So the submenu
would look exactly like the main menu currently does, except only
listing kernel entries for one OS.
I've attached a proof of concept patch which does this.
--
Jordan Uggla (Jordan_U on irc.freenode.net)
[-- Attachment #2: submenu.patch --]
[-- Type: text/x-patch, Size: 2014 bytes --]
=== modified file 'util/grub.d/10_linux.in'
--- util/grub.d/10_linux.in 2010-11-01 11:49:40 +0000
+++ util/grub.d/10_linux.in 2010-11-25 01:03:00 +0000
@@ -55,15 +55,25 @@
{
os="$1"
version="$2"
- recovery="$3"
+ type="$3"
args="$4"
- if ${recovery} ; then
- title="$(gettext_quoted "%s, with Linux %s (recovery mode)")"
+
+ case $type in
+ simple)
+ title="$(gettext_quoted "%s")" ;;
+ recovery)
+ title="$(gettext_quoted "%s, with Linux %s (recovery mode)")" ;;
+ *)
+ title="$(gettext_quoted "%s, with Linux %s")" ;;
+ esac
+
+ if [ x$type = xsimple ]; then
+ printf "menuentry '${title}' ${CLASS} {\n" "${os}"
else
- title="$(gettext_quoted "%s, with Linux %s")"
+ printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}"
fi
- printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}"
- if ! ${recovery} ; then
+
+ if [ x$type != xrecovery ] ; then
save_default_entry | sed -e "s/^/\t/"
fi
@@ -114,6 +124,8 @@
done`
prepare_boot_cache=
+is_first_entry=true
+
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
echo "Found linux image: $linux" >&2
@@ -151,12 +163,26 @@
linux_root_device_thisversion=${GRUB_DEVICE}
fi
- linux_entry "${OS}" "${version}" false \
+ if [ x$is_first_entry = xtrue ]; then
+ linux_entry "${OS}" "${version}" simple \
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+
+ cat << EOF
+submenu '$(gettext_quoted "Advanced options for ${OS}")' {
+EOF
+ fi
+
+ linux_entry "${OS}" "${version}" advanced \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
- linux_entry "${OS}" "${version}" true \
+ linux_entry "${OS}" "${version}" recovery \
"single ${GRUB_CMDLINE_LINUX}"
fi
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
+ is_first_entry=false
done
+
+if [ x$is_first_entry != xtrue ]; then #At least 1 kernel found, submenu started
+ echo '}'
+fi
next prev parent reply other threads:[~2010-11-25 2:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 17:21 [PATCH] Use submenus for 10_linux Colin Watson
2010-11-25 2:54 ` Jordan Uggla [this message]
2010-11-30 13:36 ` Žika
2010-12-05 0:54 ` Colin Watson
2010-12-05 8:11 ` Jordan Uggla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CEDCFCB.3090003@gmail.com \
--to=jordan.uggla@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.