From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1S3ppT-0006LW-RB for mharc-grub-devel@gnu.org; Sat, 03 Mar 2012 09:20:59 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3ppQ-0006L5-Rv for grub-devel@gnu.org; Sat, 03 Mar 2012 09:20:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S3ppO-0004bl-Rs for grub-devel@gnu.org; Sat, 03 Mar 2012 09:20:56 -0500 Received: from mail-ey0-f169.google.com ([209.85.215.169]:61521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3ppO-0004bf-FW for grub-devel@gnu.org; Sat, 03 Mar 2012 09:20:54 -0500 Received: by eaal1 with SMTP id l1so953939eaa.0 for ; Sat, 03 Mar 2012 06:20:52 -0800 (PST) Received-SPF: pass (google.com: domain of phcoder@gmail.com designates 10.14.199.193 as permitted sender) client-ip=10.14.199.193; Authentication-Results: mr.google.com; spf=pass (google.com: domain of phcoder@gmail.com designates 10.14.199.193 as permitted sender) smtp.mail=phcoder@gmail.com; dkim=pass header.i=phcoder@gmail.com Received: from mr.google.com ([10.14.199.193]) by 10.14.199.193 with SMTP id x41mr8162770een.29.1330784452507 (num_hops = 1); Sat, 03 Mar 2012 06:20:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=YYtWtXkdoLVhVTTHl8+l/bLLsaX/yL7BXY4bO/qFjkE=; b=b9K7AI8ufDFotVs9vxyUipx6Rws3o0FNWGBXUcxgkkhs8DIX3uecA/V/c4zsGQd744 r57qHW25p0j4hyZPmlFvcVQ7glXKhdGqcPUYhA55RKQGcwuhK9cqzL6fxTYPuzEJU146 UlnZjv7Einxqq+cV/ZFdoSHclryhS1swhzmF+E3y67VTi43XNXQbdqmHQBNtSf32TaHJ AgdA5KiFzwam/JutgGl21DGFbk8+YEhZ5zZRI3/h1qjPbgbYrU+kVADWiEq9uk7+ZoXM 2PbworFM+88Xjac0PHsW79AMNYZuN8GKi2quW4m/rUldtEB8Xu1KLAgrzl9RxpwxXNgj jhjA== Received: by 10.14.199.193 with SMTP id x41mr6250916een.29.1330784452376; Sat, 03 Mar 2012 06:20:52 -0800 (PST) Received: from debian.x201.phnet (103-234.197-178.cust.bluewin.ch. [178.197.234.103]) by mx.google.com with ESMTPS id u11sm34674758eeb.1.2012.03.03.06.20.50 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 03 Mar 2012 06:20:51 -0800 (PST) Message-ID: <4F5228C0.2020409@gmail.com> Date: Sat, 03 Mar 2012 15:20:48 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0 MIME-Version: 1.0 To: The development of GNU GRUB , Colin Watson Subject: Re: [PATCH] Add submenu support to 10_linux (grub-mkconfig) References: <4F4C117D.5090800@gmail.com> <4F4DC13F.3030402@gmail.com> In-Reply-To: <4F4DC13F.3030402@gmail.com> Content-Type: multipart/mixed; boundary="------------010006090308070408020604" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.215.169 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 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: Sat, 03 Mar 2012 14:20:58 -0000 This is a multi-part message in MIME format. --------------010006090308070408020604 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 29.02.2012 07:10, Jordan Uggla wrote: > In my first patch I rather stupidly asked gettext for a translation of "%s". > Updated patch below does not have this mistake. > I attach the update on the top of menuid. I think it would be bad to break every time user changes the configuration entry. So I'd prefer to remove this option. Now there is however a problem with migration. I see following possibilities: 1) Check in grub-mkconfig & co that GRUB_DEFAULT/saved_entry from envblk contains old or old Ubuntu-style entries and if it does add a stanza like: if [ x"$default" = x"" ]; then default="" fi and issue a warning 2) Like (1) but replace a warning with error and issue no stanza 3) Like (1) but perform no check and issue no warning and simply generate stanzas for all possible entries. Would result in a lot of clutter 4) Like (3) make check independent of stanzas and use it for issuing the warning Right now I believe that (1) is the most reasonable @Colin Watson: given the problems with current Ubuntu submenu patch and a migration way like in (1) is it possible to replace Ubuntu patch with Jordan's one for 12.10? -- Regards Vladimir 'φ-coder/phcoder' Serbinenko --------------010006090308070408020604 Content-Type: text/x-diff; name="submenu.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="submenu.diff" === modified file 'util/grub.d/10_linux.in' --- util/grub.d/10_linux.in 2012-03-03 12:12:41 +0000 +++ util/grub.d/10_linux.in 2012-03-03 13:07:51 +0000 @@ -70,18 +70,25 @@ { os="$1" version="$2" - recovery="$3" + type="$3" args="$4" - if ${recovery} ; then - title="$(gettext_quoted "%s, with Linux %s (recovery mode)")" - else - title="$(gettext_quoted "%s, with Linux %s")" - fi + + case $type in + recovery) + title="$(gettext_quoted "%s, with Linux %s (recovery mode)")" ;; + *) + title="$(gettext_quoted "%s, with Linux %s")" ;; + esac if [ -z "$boot_device_id" ]; then boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" fi - printf "menuentry '${title}' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$recovery-$boot_device_id' {\n" "${os}" "${version}" - if ! ${recovery} ; then + case $type in + if [ x$type != xsimple ] ; then + printf "menuentry '${title}' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {\n" "${os}" "${version}" + else + echo "menuentry '${os}' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" + fi + if [ x$type != xrecovery ] ; then save_default_entry | sed -e "s/^/\t/" fi @@ -156,6 +163,11 @@ prepare_root_cache= boot_device_id= +# 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 while [ "x$list" != "x" ] ; do linux=`version_find_latest $list` gettext_printf "Found linux image: %s\n" "$linux" >&2 @@ -200,12 +212,35 @@ linux_root_device_thisversion=${GRUB_DEVICE} fi - linux_entry "${OS}" "${version}" false \ - "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + if [ "x$is_first_entry" = xtrue ]; then + linux_entry "${OS}" "${version}" simple \ + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + + submenu_indentation="\t" + + if [ -z "$boot_device_id" ]; then + boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" + fi + cat << EOF +submenu '$(gettext_quoted "Advanced options for ${OS}")' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' { +EOF + fi + + linux_entry "${OS}" "${version}" advanced \ + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" \ + | sed "s/^/$submenu_indentation/" if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then - linux_entry "${OS}" "${version}" true \ - "single ${GRUB_CMDLINE_LINUX}" + linux_entry "${OS}" "${version}" recovery \ + "single ${GRUB_CMDLINE_LINUX}" \ + | sed "s/^/$submenu_indentation/" 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 + echo '}' +fi --------------010006090308070408020604--