diff options
author | Oleksij Rempel <o.rempel@pengutronix.de> | 2018-06-06 07:46:51 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-06-07 09:46:01 +0200 |
commit | 2b8c3fe861019a0ea67db23bfde82a22400c2b61 (patch) | |
tree | 1dfb1c1c06c8bcdc590f33f42a4c743b4a3bfced /defaultenv | |
parent | 8a898254168f895e79cae9dc23eada349fd5545c (diff) | |
download | barebox-2b8c3fe861019a0ea67db23bfde82a22400c2b61.tar.gz barebox-2b8c3fe861019a0ea67db23bfde82a22400c2b61.tar.xz |
defaultenv-2: make abort key to stop autoboot configurable
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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'defaultenv')
-rw-r--r-- | defaultenv/defaultenv-2-base/bin/init | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/defaultenv/defaultenv-2-base/bin/init b/defaultenv/defaultenv-2-base/bin/init index 6f3a34dbac..8d02e3d3ab 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 |