diff --git a/Documentation/user/defaultenv-2.rst b/Documentation/user/defaultenv-2.rst index db74176..7502d3d 100644 --- a/Documentation/user/defaultenv-2.rst +++ b/Documentation/user/defaultenv-2.rst @@ -93,6 +93,9 @@ # 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 6f3a34d..8d02e3d 100644 --- a/defaultenv/defaultenv-2-base/bin/init +++ b/defaultenv/defaultenv-2-base/bin/init @@ -5,6 +5,7 @@ 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 @@ 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 @@ . $i done -if [ -e /env/menu ]; then - echo -e -n "\nHit m for menu or any other key to stop autoboot: " +if [ "${global.autoboot_abort_key}" = "ctrl-c" ]; then + abort_string="ctrl-c" + abort_args="-c" else - echo -e -n "\nHit any key to stop autoboot: " + abort_string="any key" + abort_args="-a" +fi + +if [ -e /env/menu ]; then + echo -e -n "\nHit m for menu or $abort_string to stop autoboot: " +else + 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