From: Jordan Uggla <jordan.uggla@gmail.com>
To: grub-devel@gnu.org
Subject: Re: Problems with grub-reboot/savedefault/default=saved
Date: Sun, 20 Dec 2009 00:37:17 -0800 [thread overview]
Message-ID: <4B2DE23D.3070100@gmail.com> (raw)
In-Reply-To: <4B295EF3.6050401@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 813 bytes --]
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 )
[-- Attachment #2: fix1-rebased.patch --]
[-- Type: text/x-patch, Size: 768 bytes --]
=== 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
[-- Attachment #3: fix2-rebased.patch --]
[-- Type: text/x-patch, Size: 822 bytes --]
=== 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'
[-- Attachment #4: fix3-rebased.patch --]
[-- Type: text/x-patch, Size: 865 bytes --]
=== 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
[-- Attachment #5: fix4-rebased.patch --]
[-- Type: text/x-patch, Size: 587 bytes --]
=== 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 {
[-- Attachment #6: fix5.patch --]
[-- Type: text/x-patch, Size: 680 bytes --]
=== 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"
next prev parent reply other threads:[~2009-12-20 8:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-16 22:28 Problems with grub-reboot/savedefault/default=saved Jordan Uggla
2009-12-20 8:37 ` Jordan Uggla [this message]
2010-01-05 11:23 ` Colin Watson
2010-01-05 18:30 ` Embedding area too small... (GRUB2 on software RAID1) Lapohos Tibor
2010-01-05 18:30 ` Lapohos Tibor
2009-12-23 2:03 ` Problems with grub-reboot/savedefault/default=saved Colin Watson
2010-01-05 11:08 ` Colin Watson
2010-01-05 11:33 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-01-05 11:48 ` Colin Watson
2010-01-07 5:22 ` Jordan Uggla
2010-02-25 13:38 ` Colin Watson
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=4B2DE23D.3070100@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.