summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorColin Watson <cjwatson@ubuntu.com>2013-11-28 02:27:13 +0000
committerColin Watson <cjwatson@ubuntu.com>2013-11-28 02:29:15 +0000
commit8f236c141916cc149e325fd8ebeab725568bf907 (patch)
treef611747f4a2a0f866a1a5260316906bb29b0e1fe /util
parent2d76b4d81e7afc91c4d5d56c4f388e4a1e26b01d (diff)
Revamp hidden timeout handling
Add a new timeout_style environment variable and a corresponding GRUB_TIMEOUT_STYLE configuration key for grub-mkconfig. This controls hidden-timeout handling more simply than the previous arrangements, and pressing any hotkeys associated with menu entries during the hidden timeout will now boot the corresponding menu entry immediately. GRUB_HIDDEN_TIMEOUT=<non-empty> + GRUB_TIMEOUT=<non-zero> now generates a warning, and if it shows the menu it will do so as if the second timeout were not present. Other combinations are translated into reasonable equivalents.
Diffstat (limited to 'util')
-rw-r--r--util/grub-mkconfig.in1
-rw-r--r--util/grub.d/00_header.in35
2 files changed, 34 insertions, 2 deletions
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index ba1d4ef35..50f73aae5 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -186,6 +186,7 @@ export GRUB_DEFAULT \
GRUB_HIDDEN_TIMEOUT \
GRUB_HIDDEN_TIMEOUT_QUIET \
GRUB_TIMEOUT \
+ GRUB_TIMEOUT_STYLE \
GRUB_DEFAULT_BUTTON \
GRUB_HIDDEN_TIMEOUT_BUTTON \
GRUB_TIMEOUT_BUTTON \
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 983872035..d5cf34275 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -282,14 +282,45 @@ fi
make_timeout ()
{
- if [ "x${1}" != "x" ] ; then
+ if [ "x${GRUB_TIMEOUT_STYLE}" != "x" ] ; then
+ cat << EOF
+if [ x\$feature_timeout_style = xy ] ; then
+ set timeout_style=${GRUB_TIMEOUT_STYLE}
+ set timeout=${2}
+EOF
+ if [ "x${GRUB_TIMEOUT_STYLE}" != "xmenu" ] ; then
+ # Fallback hidden-timeout code in case the timeout_style feature
+ # is unavailable. Note that we now ignore GRUB_HIDDEN_TIMEOUT
+ # and take the hidden-timeout from GRUB_TIMEOUT instead.
+ if [ "x${GRUB_TIMEOUT_STYLE}" = "xhidden" ] ; then
+ verbose=
+ else
+ verbose=" --verbose"
+ fi
+ cat << EOF
+elif sleep$verbose --interruptible ${2} ; then
+ set timeout=0
+EOF
+ fi
+ cat << EOF
+fi
+EOF
+ elif [ "x${1}" != "x" ] ; then
+ if [ "x${2}" != "x0" ] ; then
+ grub_warn "$(gettext "Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.")"
+ fi
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose=
+ style="hidden"
else
verbose=" --verbose"
+ style="countdown"
fi
cat << EOF
-if sleep$verbose --interruptible ${1} ; then
+if [ x\$feature_timeout_style = xy ] ; then
+ set timeout_style=$style
+ set timeout=${1}
+elif sleep$verbose --interruptible ${1} ; then
set timeout=${2}
fi
EOF