From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1PLRyE-0007nZ-OR for mharc-grub-devel@gnu.org; Wed, 24 Nov 2010 21:54:02 -0500 Received: from [140.186.70.92] (port=47120 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLRyB-0007me-8b for grub-devel@gnu.org; Wed, 24 Nov 2010 21:54:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLRyA-0004t2-2Y for grub-devel@gnu.org; Wed, 24 Nov 2010 21:53:59 -0500 Received: from mail-pw0-f41.google.com ([209.85.160.41]:33928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PLRy9-0004sw-TT for grub-devel@gnu.org; Wed, 24 Nov 2010 21:53:58 -0500 Received: by pwi6 with SMTP id 6so825089pwi.0 for ; Wed, 24 Nov 2010 18:53:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type; bh=zHOEDffpO9sOlNd0P64yW2QQCR6RMGHMnPEQZVe95VA=; b=DjEbBePsPNrVzWMq6PRs3PI2l+XC3ExzrfMz7c079DnsImRA+T2ek23TUNC//SqEJu PVV+YiyfySC44NjYo98O69rILNylS1dauT54BjiguIWSQ5UdhuY8tJJWTFacdmKG0ITL cJcV0AD1nUP759dKCIewCa1zvw86ag1HjK+jE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; b=KwUKBVFr8fJANLSyWti91n+Y2/80b60Z4aNXQ6IhwKDCK1gTAdrL3H1tmEDKncJeje 2ulnbPJaNbsO0och6c2cTy5qEATLYcC4gtRe5T+6p/X6kKe7tOhVz8ih0qnZHzBAjLdx SsROqXNytR+dTf2FD8A1wkodIN2WPsr8uErS4= Received: by 10.142.132.6 with SMTP id f6mr150412wfd.63.1290653636087; Wed, 24 Nov 2010 18:53:56 -0800 (PST) Received: from [192.168.1.2] ([216.57.70.194]) by mx.google.com with ESMTPS id q13sm273736wfc.17.2010.11.24.18.53.54 (version=SSLv3 cipher=RC4-MD5); Wed, 24 Nov 2010 18:53:55 -0800 (PST) Message-ID: <4CEDCFCB.3090003@gmail.com> Date: Wed, 24 Nov 2010 18:54:03 -0800 From: Jordan Uggla User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 To: The development of GNU GRUB References: <20101124172029.GN21862@riva.ucam.org> In-Reply-To: <20101124172029.GN21862@riva.ucam.org> Content-Type: multipart/mixed; boundary="------------090303080406060306020508" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [PATCH] Use submenus for 10_linux X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 02:54:01 -0000 This is a multi-part message in MIME format. --------------090303080406060306020508 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. > * util/grub.d/10_linux.in: Put second and subsequent menu entries in > a submenu. > + 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) --------------090303080406060306020508 Content-Type: text/x-patch; name="submenu.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="submenu.patch" === 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 --------------090303080406060306020508--