Am Sonntag, den 07.04.2013, 14:34 +0400 schrieb Andrey Borzenkov: > В Sat, 06 Apr 2013 21:52:15 +0200 > Vladimir 'φ-coder/phcoder' Serbinenko <phco...@gmail.com> пишет: > > > On 30.01.2013 10:08, Andrey Borzenkov wrote: > > > > > + savenev next_entry > > > + savenev next_entry > > > > Have you actually tested this patch? This is not a correct comand name. > > > > Not really; it was more a question "would this even be considered". > > Here is updated patch which I actually did test :) > > From: Andrey Borzenkov <arvidj...@gmail.com> > Subject: [PATCH] reimplement grub-reboot to nor depend on GRUB_DEFAULT=saved
s,nor,not, > To: grub-devel@gnu.org > > Use separate environment variable next_entry to indicate one time > boot entry. CMOS button still takes precedent. It makes grub-reboot > usable also when GRUB_DEFAULT is set to explicit value. > > It retains support for prev_saved_entry for compatibility. Also > grub-reboot will restore saved_entry from prev_saved_entry first time > it is called. > > As a side effect it also fixes a problem that saved_entry is lost > after two consequitive grub-reboot calls. s,consequitive,consecutive, > > Signed-off-by: Andrey Borzenkov <arvidj...@gmail.com> > > --- > ChangeLog | 5 +++++ > util/grub-reboot.in | 17 ++++++----------- > util/grub-set-default.in | 1 + > util/grub.d/00_header.in | 14 +++++++++++++- > 4 files changed, 25 insertions(+), 12 deletions(-) > > diff --git a/ChangeLog b/ChangeLog > index 9163911..df12f4b 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,3 +1,8 @@ > +2013-04-07 Andrey Borzenkov <arvidj...@gmail.com> > + > + Reimplement grub-reboot to not depend on saved_entry. Use next_entry > + variabe for one time boot menu entry. *variab*l*e > + > 2013-04-06 Andrey Borzenkov <arvidj...@gmail.com> > > * conf/Makefile.extra-dist (EXTRA_DIST): Add > diff --git a/util/grub-reboot.in b/util/grub-reboot.in > index 1a91d36..d132e4f 100644 > --- a/util/grub-reboot.in > +++ b/util/grub-reboot.in > @@ -46,8 +46,6 @@ export TEXTDOMAINDIR="@localedir@" > usage () { > gettext_printf "Usage: %s [OPTION] MENU_ENTRY\n" "$self" > gettext "Set the default boot menu entry for GRUB, for the next boot > only."; echo > - gettext_printf "This requires setting GRUB_DEFAULT=saved in > %s/default/grub.\n" "$sysconfdir" > - echo > print_option_help "-h, --help" "$(gettext "print this message and exit")" > print_option_help "-v, --version" "$(gettext "print the version > information and exit")" > dirmsg="$(gettext_printf "expect GRUB images under the directory DIR/%s > instead of the %s directory" "@grubdirname@" "$grubdir")" > @@ -129,17 +127,14 @@ fi > > grubdir=`echo "${bootdir}/@grubdirname@" | sed 's,//*,/,g'` > > -prev_saved_entry=`$grub_editenv ${grubdir}/grubenv list | sed -n > 's/^saved_entry=//p'` > +# Restore saved_entry if it was set by previous version > +prev_saved_entry=`$grub_editenv ${grubdir}/grubenv list | sed -n > 's/^prev_saved_entry=//p'` > if [ "$prev_saved_entry" ]; then > - $grub_editenv ${grubdir}/grubenv set prev_saved_entry="$prev_saved_entry" > -else > - # We need some non-empty value for prev_saved_entry so that GRUB will > - # recognise that grub-reboot has been used and restore the previous > - # saved entry. "0" is the same as an empty value, i.e. the first menu > - # entry. > - $grub_editenv ${grubdir}/grubenv set prev_saved_entry=0 > + $grub_editenv ${grubdir}/grubenv set saved_entry="$prev_saved_entry" > + $grub_editenv ${grubdir}/grubenv unset prev_saved_entry > fi > -$grub_editenv ${grubdir}/grubenv set saved_entry="$entry" > + > +$grub_editenv ${grubdir}/grubenv set next_entry="$entry" > > # Bye. > exit 0 > diff --git a/util/grub-set-default.in b/util/grub-set-default.in > index ea18da1..d607318 100644 > --- a/util/grub-set-default.in > +++ b/util/grub-set-default.in > @@ -130,6 +130,7 @@ fi > grubdir=`echo "${bootdir}/@grubdirname@" | sed 's,//*,/,g'` > > $grub_editenv ${grubdir}/grubenv unset prev_saved_entry > +$grub_editenv ${grubdir}/grubenv unset next_entry > $grub_editenv ${grubdir}/grubenv set saved_entry="$entry" > > # Bye. > diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in > index 3da5d12..2c4bb0a 100644 > --- a/util/grub.d/00_header.in > +++ b/util/grub.d/00_header.in > @@ -51,13 +51,25 @@ if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then > cat <<EOF > if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then > set default="${GRUB_DEFAULT_BUTTON}" > +elif [ "\${next_entry}" ] ; then > + set default="\${next_entry}" > + set next_entry= > + save_env next_entry > + set boot_once=true > else > set default="${GRUB_DEFAULT}" > fi > EOF > else > cat <<EOF > -set default="${GRUB_DEFAULT}" > +if [ "\${next_entry}" ] ; then > + set default="\${next_entry}" > + set next_entry= > + save_env next_entry > + set boot_once=true > +else > + set default="${GRUB_DEFAULT}" > +fi > EOF > fi > cat <<EOF Otherwise I did not spot anything. Thanks, Paul
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel