fix: improve logging, startup handling, and binary checks

This commit is contained in:
taamarin
2025-08-18 09:05:31 +07:00
parent d28ba2f645
commit bafca21025
3 changed files with 12 additions and 10 deletions

View File

@@ -113,6 +113,7 @@ check_module_service() {
done
if [ -n "$current_ip" ]; then
echo "-- Notifikasi LOG --" > "$log_file"
log_msg "--- Network state change: WiFi connected ---"
log_msg "SSID: ${ssid}, IP: ${current_ip}"
echo "ssid:${ssid}" > "$last_wifi_state_file"

View File

@@ -1,14 +1,14 @@
#!/system/bin/sh
(
until [ $(getprop init.svc.bootanim) = "stopped" ]; do
until [ "$(getprop init.svc.bootanim)" = "stopped" ]; do
sleep 10
done
if [ -f "/data/adb/box/scripts/start.sh" ]; then
chmod 755 /data/adb/box/scripts/*
/data/adb/box/scripts/start.sh
chmod -R 755 /data/adb/box/scripts/
/data/adb/box/scripts/start.sh >/dev/null 2>&1
else
echo "File '/data/adb/box/scripts/start.sh' not found"
echo "File /data/adb/box/scripts/start.sh not found" > "/data/adb/box/run/box_service.log"
fi
)&
) &

View File

@@ -113,10 +113,10 @@ find_bin() {
local path="$bin_dir/bin/$name"
if [ -e "$path" ]; then
ui_print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
ui_print "📦 $name → ⭕ FOUND"
ui_print "— $name → ⭕ FOUND"
else
ui_print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
ui_print "📦 $name → ❌ NOT FOUND"
ui_print "— $name → ❌ NOT FOUND"
fi
}
@@ -155,7 +155,7 @@ find_bin() {
}
# List of binaries to check
for bin in sing-box v2fly xray curl yq hysteria; do
for bin in yq curl sing-box v2fly xray hysteria; do
timeout 1 getevent -cl >/dev/null
check_bin "$bin"
@@ -163,19 +163,20 @@ find_bin() {
ui_print "— [ Vol UP(+): Yes ]"
ui_print "— [ Vol DOWN(-): No ]"
handle_download "$bin"
sleep 1
done
# Special case for clash
if [ -e "$bin_dir/bin/xclash/mihomo" ]; then
ui_print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
ui_print "📦 mihomo → ⭕ FOUND"
ui_print "— mihomo → ⭕ FOUND"
ui_print "-- Do you want to download or update clash?"
ui_print "— [ Vol UP(+): Yes ]"
ui_print "— [ Vol DOWN(-): No ]"
handle_download "clash"
else
ui_print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
ui_print "📦 mihomo → ❌ NOT FOUND "
ui_print "— mihomo → ❌ NOT FOUND "
ui_print "— Do you want to download or update mihomo?"
ui_print "— [ Vol UP(+): Yes ]"
ui_print "— [ Vol DOWN(-): No ]"