Skip to content

Commit

Permalink
Add 10s timeout for Kernel Download. (#84)
Browse files Browse the repository at this point in the history
* 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
sandatjepil authored Jan 29, 2024
1 parent b2a68c8 commit e9626e6
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions customize.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e9626e6

Please sign in to comment.