Add 10s timeout for Kernel Download. (#84)
* customize.sh: Add 10s timeout for Kernel Download. some users complaining about broken volume keys. so here we added 10s timeout for pressing vol-up or vol-down. if time runs out and no input from users, script will download the kernel anyway. * customize.sh: fixing syntax
This commit is contained in:
21
customize.sh
Executable file → Normal file
21
customize.sh
Executable file → Normal file
@@ -84,15 +84,24 @@ ui_print "- Make sure you have a good internet connection."
|
||||
ui_print "- [ Vol UP(+): Yes ]"
|
||||
ui_print "- [ Vol DOWN(-): No ]"
|
||||
|
||||
START_TIME=$(date +%s)
|
||||
while true ; do
|
||||
getevent -lc 1 2>&1 | grep KEY_VOLUME > $TMPDIR/events
|
||||
if $(cat $TMPDIR/events | grep -q KEY_VOLUMEUP) ; then
|
||||
ui_print "- It will take a while...."
|
||||
NOW_TIME=$(date +%s)
|
||||
timeout 1 getevent -lc 1 2>&1 | grep KEY_VOLUME > "$TMPDIR/events"
|
||||
if [ $(( NOW_TIME - START_TIME )) -gt 9 ] ; then
|
||||
ui_print "- No input detected after 10 seconds"
|
||||
ui_print "- Downloading Kernel Anyway...."
|
||||
/data/adb/box/scripts/box.tool all
|
||||
break
|
||||
elif $(cat $TMPDIR/events | grep -q KEY_VOLUMEDOWN) ; then
|
||||
ui_print "- Skip download Kernel and Geox"
|
||||
break
|
||||
else
|
||||
if $(cat $TMPDIR/events | grep -q KEY_VOLUMEUP) ; then
|
||||
ui_print "- It will take a while...."
|
||||
/data/adb/box/scripts/box.tool all
|
||||
break
|
||||
elif $(cat $TMPDIR/events | grep -q KEY_VOLUMEDOWN) ; then
|
||||
ui_print "- Skip download Kernel and Geox"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user