From 20eb816075b0b6cc34f7293f906a72bae74caca3 Mon Sep 17 00:00:00 2001 From: anzz1 Date: Sun, 18 Jun 2023 07:37:15 +0300 Subject: [PATCH] shutdown: add -r for reboot --- extras/Tools/OTA Update.pak/launch.sh | 1 + skeleton/.system/bin/shutdown | 14 +++++++++----- skeleton/.system/paks/MiniUI.pak/launch.sh | 4 +++- skeleton/.tmp_update/runtime.sh | 3 +-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/extras/Tools/OTA Update.pak/launch.sh b/extras/Tools/OTA Update.pak/launch.sh index aa80e13..d14244b 100644 --- a/extras/Tools/OTA Update.pak/launch.sh +++ b/extras/Tools/OTA Update.pak/launch.sh @@ -111,6 +111,7 @@ progress 100 "Rebooting ..." sleep 2 progress quit +shutdown -r while true; do sync && reboot && sleep 10 done diff --git a/skeleton/.system/bin/shutdown b/skeleton/.system/bin/shutdown index c5f091b..43c6b09 100755 --- a/skeleton/.system/bin/shutdown +++ b/skeleton/.system/bin/shutdown @@ -24,17 +24,21 @@ fatality() { } if [ "$0" = "/tmp/_shutdown" ]; then - killall telnetd ftpd tcpsvd main updater runtime.sh launch.sh + killall telnetd ftpd tcpsvd main keymon MainUI updater runtime.sh launch.sh fatality sync umount -r /mnt/SDCARD - killall -9 telnetd ftpd tcpsvd main updater runtime.sh launch.sh + killall -9 telnetd ftpd tcpsvd main keymon MainUI updater runtime.sh launch.sh fatality -9 sync umount /mnt/SDCARD while true; do sync - poweroff + if [ "$1" = "-r" ]; then + reboot + else + poweroff + fi sleep 10 done fi @@ -44,12 +48,12 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin if [ ! -z "$DATETIME_PATH" ]; then date -u +%s > "$DATETIME_PATH" fi -rm -f /tmp/miniui_exec +rm -f /tmp/miniui_exec /tmp/next sync if [ ! -f /tmp/_shutdown ]; then cp -f /mnt/SDCARD/.system/bin/shutdown /tmp/_shutdown fi -pgrep -f /tmp/_shutdown || (set -m; /tmp/_shutdown /dev/null 2>&1 &) +pgrep -f /tmp/_shutdown || (set -m; /tmp/_shutdown $1 /dev/null 2>&1 &) while true; do sleep 10 done diff --git a/skeleton/.system/paks/MiniUI.pak/launch.sh b/skeleton/.system/paks/MiniUI.pak/launch.sh index 47dbe51..347908c 100755 --- a/skeleton/.system/paks/MiniUI.pak/launch.sh +++ b/skeleton/.system/paks/MiniUI.pak/launch.sh @@ -115,4 +115,6 @@ while [ -f "$EXEC_PATH" ]; do done shutdown -poweroff # just in case +while true; do + sync && poweroff && sleep 10 +done diff --git a/skeleton/.tmp_update/runtime.sh b/skeleton/.tmp_update/runtime.sh index 6895a3e..1df1a28 100644 --- a/skeleton/.tmp_update/runtime.sh +++ b/skeleton/.tmp_update/runtime.sh @@ -14,6 +14,5 @@ if [ -f "$LAUNCH_PATH" ]; then fi while true; do - reboot - sleep 10 + sync && reboot && sleep 10 done