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)"
} &
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
[ -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
}