mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2] defaultenv-2: make abort key to stop autoboot configurable
Date: Thu, 7 Jun 2018 09:46:11 +0200	[thread overview]
Message-ID: <20180607074611.dafexjqwcberzhkg@pengutronix.de> (raw)
In-Reply-To: <20180606054651.11813-1-o.rempel@pengutronix.de>

On Wed, Jun 06, 2018 at 07:46:51AM +0200, Oleksij Rempel wrote:
> currently supported only two options: any key and ctrl-c
> "any key" is default option.
> To configure it, use:
> nv autoboot_abort_key=any
> or
> nv autoboot_abort_key=ctrl-c
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---

Applied, thanks

Sascha

>  Documentation/user/defaultenv-2.rst   |  3 +++
>  defaultenv/defaultenv-2-base/bin/init | 17 ++++++++++++++---
>  2 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/user/defaultenv-2.rst b/Documentation/user/defaultenv-2.rst
> index db74176b0..7502d3de1 100644
> --- a/Documentation/user/defaultenv-2.rst
> +++ b/Documentation/user/defaultenv-2.rst
> @@ -93,6 +93,9 @@ the :ref:`command_edit` command. Typical content:
>    # timeout in seconds before the default boot entry is started
>    #global.autoboot_timeout=3
>  
> +  # key to abort autoboot. Supported options are: "any" and "ctrl-c"
> +  #global.autoboot_abort_key=any
> +
>    # list of boot entries. These are executed in order until one
>    # succeeds. An entry can be:
>    # - a filename in /env/boot/
> diff --git a/defaultenv/defaultenv-2-base/bin/init b/defaultenv/defaultenv-2-base/bin/init
> index 6f3a34dba..8d02e3d3a 100644
> --- a/defaultenv/defaultenv-2-base/bin/init
> +++ b/defaultenv/defaultenv-2-base/bin/init
> @@ -5,6 +5,7 @@ export PATH=/env/bin
>  global hostname
>  global user
>  global autoboot_timeout
> +global autoboot_abort_key
>  global boot.default
>  global linux.bootargs.base
>  global linux.bootargs.console
> @@ -18,6 +19,8 @@ global editcmd
>  magicvar -a global.user "username (used in network filenames)"
>  [ -z "${global.autoboot_timeout}" ] && global.autoboot_timeout=3
>  magicvar -a global.autoboot_timeout "timeout in seconds before automatic booting"
> +[ -z "${global.autoboot_abort_key}" ] && global.autoboot_abort_key=any
> +magicvar -a global.autoboot_abort_key "key to abort automatic booting (valid options: any, ctrl-c)"
>  [ -z "${global.boot.default}" ] && global.boot.default=net
>  [ -z "${global.editcmd}" ] && global.editcmd=sedit
>  
> @@ -38,14 +41,22 @@ for i in /env/init/*; do
>  	. $i
>  done
>  
> +if [ "${global.autoboot_abort_key}" = "ctrl-c" ]; then
> +	abort_string="ctrl-c"
> +	abort_args="-c"
> +else
> +	abort_string="any key"
> +	abort_args="-a"
> +fi
> +
>  if [ -e /env/menu ]; then
> -	echo -e -n "\nHit m for menu or any other key to stop autoboot: "
> +	echo -e -n "\nHit m for menu or $abort_string to stop autoboot: "
>  else
> -	echo -e -n "\nHit any key to stop autoboot: "
> +	echo -e -n "\nHit $abort_string to stop autoboot: "
>  fi
>  
>  if [ "$autoboot" = 0 ]; then
> -	timeout -a $global.autoboot_timeout -v key
> +	timeout $abort_args $global.autoboot_timeout -v key
>  	autoboot="$?"
>  fi
>  
> -- 
> 2.17.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2018-06-07  7:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06  5:46 Oleksij Rempel
2018-06-07  7:46 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180607074611.dafexjqwcberzhkg@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=o.rempel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox