From 74a4206c76c090a720bd69317f1df24c369f74bd Mon Sep 17 00:00:00 2001 From: Andrea Date: Fri, 8 Sep 2023 23:53:38 +0800 Subject: [PATCH] Add '10-thunderkey.sh' --- 10-thunderkey.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 10-thunderkey.sh diff --git a/10-thunderkey.sh b/10-thunderkey.sh new file mode 100644 index 0000000..6aba76d --- /dev/null +++ b/10-thunderkey.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# luhf @ git.monocul.us - Andrea Santaniello + +do_magic() { + local lockfile="/tmp/TBREBOOT" + if [ -e "$lockfile" ]; then + echo "Lockfile already exists. Process might be running." + + else + touch "$lockfile" + echo "Lockfile created at $lockfile starting procedure." + # Beep Signal + /sbin/hal_app --se_buzzer enc_id=0,mode=100 + /sbin/hal_app --se_buzzer enc_id=0,mode=101 + /sbin/hal_app --se_buzzer enc_id=0,mode=100 + # Restart TB services. + /etc/init.d/thunderbolt.sh stop + sleep 5 + # Final Beep + /etc/init.d/thunderbolt.sh start + /sbin/hal_app --se_buzzer enc_id=0,mode=100 + /sbin/hal_app --se_buzzer enc_id=0,mode=101 + /sbin/hal_app --se_buzzer enc_id=0,mode=100 + fi +} + + +while true; do + # HOW TO: get a usb drive, nothing fancy, create an empty file named RESETTB, change path here. + if [ -e "/share/external/DEV3301_1/RESETTB" ]; then + if [ -e "/tmp/TBREBOOT" ]; then + rm /tmp/TBREBOOT + /sbin/hal_app --se_buzzer enc_id=0,mode=100 + /sbin/hal_app --se_buzzer enc_id=0,mode=100 + fi + echo "RESETTB found!" + sleep 5 + else + echo "RESETTB not found. Waiting..." + do_magic + sleep 5 + fi +done \ No newline at end of file