mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-24 14:32:58 +00:00
f74b50e380
Signed-off-by: Peter Jones <pjones@redhat.com>
109 lines
3.8 KiB
Diff
109 lines
3.8 KiB
Diff
From 1424a23f9d76785da41d3f8ccd9f0658abd062da Mon Sep 17 00:00:00 2001
|
|
From: Andrey Borzenkov <arvidjaar@gmail.com>
|
|
Date: Mon, 6 May 2013 22:13:34 +0400
|
|
Subject: [PATCH 428/482] Reimplement grub-reboot to not depend on
|
|
saved_entry. Use next_entry variable for one time boot menu entry.
|
|
|
|
---
|
|
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 b79c57a..16c5404 100644
|
|
--- a/ChangeLog
|
|
+++ b/ChangeLog
|
|
@@ -1,3 +1,8 @@
|
|
+2013-05-06 Andrey Borzenkov <arvidjaar@gmail.com>
|
|
+
|
|
+ Reimplement grub-reboot to not depend on saved_entry. Use next_entry
|
|
+ variable for one time boot menu entry.
|
|
+
|
|
2013-05-05 Bean <bean123ch@gmail.com>
|
|
|
|
* grub-core/commands/testspeed.c: New command testspeed.
|
|
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
|
|
--
|
|
1.8.2.1
|
|
|