From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NMHIQ-0007pW-A9 for mharc-grub-devel@gnu.org; Sun, 20 Dec 2009 03:37:46 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NMHIJ-0007m7-53 for grub-devel@gnu.org; Sun, 20 Dec 2009 03:37:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NMHIC-0007j6-HP for grub-devel@gnu.org; Sun, 20 Dec 2009 03:37:37 -0500 Received: from [199.232.76.173] (port=55263 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMHIB-0007ik-IB for grub-devel@gnu.org; Sun, 20 Dec 2009 03:37:31 -0500 Received: from mail-yw0-f202.google.com ([209.85.211.202]:53360) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NMHIA-00041G-AW for grub-devel@gnu.org; Sun, 20 Dec 2009 03:37:30 -0500 Received: by ywh40 with SMTP id 40so4579214ywh.26 for ; Sun, 20 Dec 2009 00:37:28 -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=q3BxVkGv+y7mQOiFzYK1O+j+bzjQvIlOA2444tBP9RI=; b=sW+caLipf20sm8CVooN1icAfHdQHXyd0guVKn9JhEnCeA1AnLk5sht/zSjUO/bttO1 CRS7Qwv1lX6VITWAS5rRYH5L5uYpnhg1tSBxn3KEsb1KRhQDiLC9uSoNO0c2ohEC2M4l zTPTpOLzlWca5NJ7Ck0rcWEqzTxQ4vWepjSwI= 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=CcAPlw7nfnJiP3tAeyvug4yxPAeA2zHmHLsK7EGI3ZlWZHbH4EeC6TbRf09Ncq66yE cgr0Dcpy8Iu896VIzNSkP7GTM0CVlmb7xcioqd84GZ11ccv48UaoV7xNwdWl9AqzT8OM 4tnL4i34SQEI0Iv0O1cwDp3BG5kyQksPUPgrg= Received: by 10.101.5.17 with SMTP id h17mr9314415ani.125.1261298248554; Sun, 20 Dec 2009 00:37:28 -0800 (PST) Received: from ?192.168.1.2? (adsl-99-155-194-157.dsl.pltn13.sbcglobal.net [99.155.194.157]) by mx.google.com with ESMTPS id 21sm3730075iwn.2.2009.12.20.00.37.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 20 Dec 2009 00:37:27 -0800 (PST) Message-ID: <4B2DE23D.3070100@gmail.com> Date: Sun, 20 Dec 2009 00:37:17 -0800 From: Jordan Uggla User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: grub-devel@gnu.org References: <4B295EF3.6050401@gmail.com> In-Reply-To: <4B295EF3.6050401@gmail.com> Content-Type: multipart/mixed; boundary="------------060500020809070205090102" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: Problems with grub-reboot/savedefault/default=saved 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: Sun, 20 Dec 2009 08:37:40 -0000 This is a multi-part message in MIME format. --------------060500020809070205090102 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I found another bug. For some reason grub-reboot ( the utility ) checks if prev_saved_entry ( which has just been set equal to saved_entry ) is empty ( zero length or unset ), and if it is unsets it. This makes grub-reboot again equivalent to grub-set-default the first time you use it. Instead I changed it so that if prev_saved_entry is empty it gets set to "0" because default=0 is the same as default="" but the grub.cfg detects that you've used grub-reboot by checking if prev_saved_entry is not empty. I've attached a fix for this and also updated my previous patches so they apply cleanly and are consistent with the new changes from the savedefault branch that were merged into experimental ( using set var=value instead of just var=value ). -- Jordan Uggla ( Jordan_U on irc.freenode.net ) --------------060500020809070205090102 Content-Type: text/x-patch; name="fix1-rebased.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fix1-rebased.patch" === modified file 'util/grub-mkconfig_lib.in' --- old/util/grub-mkconfig_lib.in 2009-12-17 17:34:56 +0000 +++ new/util/grub-mkconfig_lib.in 2009-12-16 20:12:30 +0000 @@ -97,8 +97,10 @@ save_default_entry () { if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then - echo 'set saved_entry=${chosen}' - echo 'save_env saved_entry' + echo 'if [ ${boot_once} != true ]; then' + echo ' set saved_entry=${chosen}' + echo ' save_env saved_entry' + echo 'fi' fi } === modified file 'util/grub.d/00_header.in' --- old/util/grub.d/00_header.in 2009-12-17 17:34:56 +0000 +++ new/util/grub.d/00_header.in 2009-12-16 20:12:30 +0000 @@ -48,6 +48,7 @@ save_env saved_entry set prev_saved_entry= save_env prev_saved_entry + set boot_once=true fi EOF --------------060500020809070205090102 Content-Type: text/x-patch; name="fix2-rebased.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fix2-rebased.patch" === modified file 'util/grub-mkconfig.in' --- old/util/grub-mkconfig.in 2009-12-12 00:43:32 +0000 +++ new/util/grub-mkconfig.in 2009-12-16 20:22:36 +0000 @@ -220,7 +220,8 @@ GRUB_DISABLE_LINUX_UUID \ GRUB_DISABLE_LINUX_RECOVERY \ GRUB_GFXMODE \ - GRUB_DISABLE_OS_PROBER + GRUB_DISABLE_OS_PROBER \ + GRUB_SAVEDEFAULT if test "x${grub_cfg}" != "x"; then rm -f ${grub_cfg}.new === modified file 'util/grub-mkconfig_lib.in' --- old/util/grub-mkconfig_lib.in 2009-12-16 20:12:30 +0000 +++ new/util/grub-mkconfig_lib.in 2009-12-16 20:22:36 +0000 @@ -96,7 +96,7 @@ save_default_entry () { - if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then + if [ "x${GRUB_SAVEDEFAULT}" = "xtrue" ] ; then echo 'if [ ${boot_once} != true ]; then' echo ' set saved_entry=${chosen}' echo ' save_env saved_entry' --------------060500020809070205090102 Content-Type: text/x-patch; name="fix3-rebased.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fix3-rebased.patch" === modified file 'util/grub-mkconfig_lib.in' --- old/util/grub-mkconfig_lib.in 2009-12-16 20:22:36 +0000 +++ new/util/grub-mkconfig_lib.in 2009-12-16 20:25:37 +0000 @@ -97,10 +97,7 @@ save_default_entry () { if [ "x${GRUB_SAVEDEFAULT}" = "xtrue" ] ; then - echo 'if [ ${boot_once} != true ]; then' - echo ' set saved_entry=${chosen}' - echo ' save_env saved_entry' - echo 'fi' + echo 'savedefault' fi } === modified file 'util/grub.d/00_header.in' --- old/util/grub.d/00_header.in 2009-12-16 20:12:30 +0000 +++ new/util/grub.d/00_header.in 2009-12-16 20:25:37 +0000 @@ -50,6 +50,14 @@ save_env prev_saved_entry set boot_once=true fi + +function savedefault { + if [ \${boot_once} != true ]; then + set saved_entry=\${chosen} + save_env saved_entry + fi +} + EOF case ${GRUB_TERMINAL_INPUT}:${GRUB_TERMINAL_OUTPUT} in --------------060500020809070205090102 Content-Type: text/x-patch; name="fix4-rebased.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fix4-rebased.patch" === modified file 'util/grub.d/00_header.in' --- old/util/grub.d/00_header.in 2009-12-16 20:25:37 +0000 +++ new/util/grub.d/00_header.in 2009-12-20 01:45:32 +0000 @@ -45,10 +45,13 @@ set default="${GRUB_DEFAULT}" if [ \${prev_saved_entry} ]; then set saved_entry=\${prev_saved_entry} - save_env saved_entry - set prev_saved_entry= - save_env prev_saved_entry - set boot_once=true + if save_env saved_entry; then + set prev_saved_entry= + save_env prev_saved_entry + set boot_once=true + else + set default=\${prev_saved_entry} + fi fi function savedefault { --------------060500020809070205090102 Content-Type: text/x-patch; name="fix5.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fix5.patch" === modified file 'util/grub-reboot.in' --- old/util/grub-reboot.in 2009-12-08 01:00:26 +0000 +++ new/util/grub-reboot.in 2009-12-20 06:57:34 +0000 @@ -96,7 +96,10 @@ if [ "$prev_saved_entry" ]; then $grub_editenv ${grubdir}/grubenv set prev_saved_entry="$prev_saved_entry" else - $grub_editenv ${grubdir}/grubenv unset prev_saved_entry + #Set prev_saved_entry to zero. Setting the default to "0" is the same as + #setting it to "" but because of the way grub-reboot is currently + #implemented prev_saved_entry can't be zero length. + $grub_editenv ${grubdir}/grubenv set prev_saved_entry=0 fi $grub_editenv ${grubdir}/grubenv set saved_entry="$entry" --------------060500020809070205090102--