Add GRUB_TIMEOUT_STYLE_BUTTON support

Suggested by Vladimir Serbinenko.
This commit is contained in:
Colin Watson 2013-11-29 15:18:05 +00:00
parent 471b2683e7
commit 53cc63bf85
3 changed files with 20 additions and 16 deletions

View file

@ -1317,6 +1317,7 @@ case, it will show a one-line indication of the remaining time.
@item GRUB_DEFAULT_BUTTON
@itemx GRUB_TIMEOUT_BUTTON
@itemx GRUB_TIMEOUT_STYLE_BUTTON
@itemx GRUB_BUTTON_CMOS_ADDRESS
Variants of the corresponding variables without the @samp{_BUTTON} suffix,
used to support vendor-specific power buttons. @xref{Vendor power-on keys}.
@ -2517,15 +2518,17 @@ menu requires several fancy features of your terminal.
@node Vendor power-on keys
@chapter Using GRUB with vendor power-on keys
Some laptop vendors provide an additional power-on button which boots another
OS. GRUB supports such buttons with the @samp{GRUB_TIMEOUT_BUTTON},
@samp{GRUB_DEFAULT_BUTTON}, @samp{GRUB_HIDDEN_TIMEOUT_BUTTON} and
@samp{GRUB_BUTTON_CMOS_ADDRESS} variables in default/grub (@pxref{Simple
configuration}). @samp{GRUB_TIMEOUT_BUTTON}, @samp{GRUB_DEFAULT_BUTTON} and
@samp{GRUB_HIDDEN_TIMEOUT_BUTTON} are used instead of the corresponding
variables without the @samp{_BUTTON} suffix when powered on using the special
button. @samp{GRUB_BUTTON_CMOS_ADDRESS} is vendor-specific and partially
model-specific. Values known to the GRUB team are:
Some laptop vendors provide an additional power-on button which boots
another OS. GRUB supports such buttons with the @samp{GRUB_TIMEOUT_BUTTON},
@samp{GRUB_TIMEOUT_STYLE_BUTTON}, @samp{GRUB_DEFAULT_BUTTON},
@samp{GRUB_HIDDEN_TIMEOUT_BUTTON} and @samp{GRUB_BUTTON_CMOS_ADDRESS}
variables in default/grub (@pxref{Simple configuration}).
@samp{GRUB_TIMEOUT_BUTTON}, @samp{GRUB_TIMEOUT_STYLE_BUTTON},
@samp{GRUB_DEFAULT_BUTTON}, and @samp{GRUB_HIDDEN_TIMEOUT_BUTTON} are used
instead of the corresponding variables without the @samp{_BUTTON} suffix
when powered on using the special button. @samp{GRUB_BUTTON_CMOS_ADDRESS}
is vendor-specific and partially model-specific. Values known to the GRUB
team are:
@table @key
@item Dell XPS M1330M

View file

@ -190,6 +190,7 @@ export GRUB_DEFAULT \
GRUB_DEFAULT_BUTTON \
GRUB_HIDDEN_TIMEOUT_BUTTON \
GRUB_TIMEOUT_BUTTON \
GRUB_TIMEOUT_STYLE_BUTTON \
GRUB_BUTTON_CMOS_ADDRESS \
GRUB_BUTTON_CMOS_CLEAN \
GRUB_DISTRIBUTOR \

View file

@ -282,17 +282,17 @@ fi
make_timeout ()
{
if [ "x${GRUB_TIMEOUT_STYLE}" != "x" ] ; then
if [ "x${3}" != "x" ] ; then
cat << EOF
if [ x\$feature_timeout_style = xy ] ; then
set timeout_style=${GRUB_TIMEOUT_STYLE}
set timeout_style=${3}
set timeout=${2}
EOF
if [ "x${GRUB_TIMEOUT_STYLE}" != "xmenu" ] ; then
if [ "x${3}" != "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
if [ "x${3}" = "xhidden" ] ; then
verbose=
else
verbose=" --verbose"
@ -335,12 +335,12 @@ if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
cat <<EOF
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
EOF
make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_STYLE_BUTTON}"
echo else
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}" "${GRUB_TIMEOUT_STYLE}"
echo fi
else
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}" "${GRUB_TIMEOUT_STYLE}"
fi
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ] && [ "x$GRUB_BUTTON_CMOS_CLEAN" = "xyes" ]; then