X-Git-Url: https://git.archive.openwrt.org/?p=openwrt.git;a=blobdiff_plain;f=package%2Fbase-files%2Ffiles%2Flib%2Fpreinit%2F30_failsafe_wait;h=522565940cccc88ecf30cf1499bda3c8fb3c4deb;hp=6bce8ae49f3cae68d057f490eac3f616cdd03d73;hb=1cd654611f450bd2ce579590a9118e7c84712587;hpb=0eed0af1d6d697a9fd82271544cfb3e38062861f diff --git a/package/base-files/files/lib/preinit/30_failsafe_wait b/package/base-files/files/lib/preinit/30_failsafe_wait index 6bce8ae49f..522565940c 100644 --- a/package/base-files/files/lib/preinit/30_failsafe_wait +++ b/package/base-files/files/lib/preinit/30_failsafe_wait @@ -5,7 +5,7 @@ fs_wait_for_key () { local timeout=$3 local timer - local do_failsafe + local do_keypress local keypress_true="$(mktemp)" local keypress_wait="$(mktemp)" local keypress_sec="$(mktemp)" @@ -40,6 +40,7 @@ fs_wait_for_key () { } & echo "Press the [$1] key and hit [enter] $2" + echo "Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level" # if we're on the console we wait for input { while [ -r $keypress_wait ]; do @@ -48,14 +49,22 @@ fs_wait_for_key () { [ -n "$timer" ] || timer=1 timer="${timer%%\ *}" [ $timer -ge 1 ] || timer=1 - do_failsafe="" + do_keypress="" { - read -t "$timer" do_failsafe - if [ "$do_failsafe" = "$1" ]; then - echo "true" >$keypress_true - lock -u $keypress_wait - rm -f $keypress_wait - fi + read -t "$timer" do_keypress + case "$do_keypress" in + $1) + echo "true" >$keypress_true + ;; + 1 | 2 | 3 | 4) + echo "$do_keypress" >/tmp/debug_level + ;; + *) + continue; + ;; + esac + lock -u $keypress_wait + rm -f $keypress_wait } done }