From 53cc63bf851a057ab5275825dfc1aebffe08302e Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 29 Nov 2013 15:18:05 +0000 Subject: [PATCH] Add GRUB_TIMEOUT_STYLE_BUTTON support Suggested by Vladimir Serbinenko. --- docs/grub.texi | 21 ++++++++++++--------- util/grub-mkconfig.in | 1 + util/grub.d/00_header.in | 14 +++++++------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi index f9299041f..e730d9191 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -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 diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index 50f73aae5..016ee8259 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -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 \ diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in index d5cf34275..6e8eb8436 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -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 <