fix: non-disruptive startup checks + clean service lifecycle (v1.3.1)
- Env check is read-only when state is sane: no pineapd command-socket writes, no live pool-list commits, no wifi reload; pineapd restarts only when a runtime-sensitive UCI value changed or the daemon was down - Failed monitor repairs now fail the startup contract instead of being reported as fixed; runtime pool state is read from active config - Enterprise AP recovery runs only on device boot (PAGER_WEBUI_BOOT), not on every web-service restart - serve() gates the HTTP port on startup checks with bounded retries and shuts down cleanly on SIGTERM/SIGINT; the recon watchdog waits interruptibly - Recon uses a bounded userspace channel scheduler that drives both monitor radios over non-DFS channels, with preflight verification, serialized starts, and per-cycle error reporting - payload.sh waits for real readiness on start, fully removes the boot service (stop + disable + delete) on stop, and surfaces a stopped-but-enabled boot service; deploy.sh refreshes the installed init script even when the service is stopped - Bump version to 1.3.1 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
parent
6e3968c19a
commit
cd26553d21
@@ -2,7 +2,7 @@
|
||||
# Title: Mark VIII
|
||||
# Description: Mark VII-style web management UI for the WiFi Pineapple Pager
|
||||
# Author: c4ch3c4d3
|
||||
# Version: 1.3
|
||||
# Version: 1.3.1
|
||||
# Category: Remote-Access
|
||||
# Tags: remote-access, web-interface, device-management, pineap
|
||||
# Firmware: Pineapple Pager 24.10.1
|
||||
@@ -28,7 +28,7 @@ get_pager_ip() {
|
||||
}
|
||||
|
||||
LOG "cyan" "+---------------------------+"
|
||||
LOG "cyan" "| Mark VIII v1.3 |"
|
||||
LOG "cyan" "| Mark VIII v1.3.1 |"
|
||||
LOG "cyan" "+---------------------------+"
|
||||
|
||||
if ! command -v python3 >/dev/null 2>&1; then
|
||||
@@ -46,6 +46,36 @@ run_env_check() {
|
||||
LOG "green" "Environment check passed."
|
||||
}
|
||||
|
||||
wait_for_server() {
|
||||
attempts="${1:-30}"
|
||||
while [ "$attempts" -gt 0 ]; do
|
||||
if curl -fsS "http://127.0.0.1:$PORT/" >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
attempts=$((attempts - 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_server_stop() {
|
||||
attempts="${1:-12}"
|
||||
while [ "$attempts" -gt 0 ]; do
|
||||
if ! curl -fsS "http://127.0.0.1:$PORT/" >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
attempts=$((attempts - 1))
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
remove_boot_service() {
|
||||
"$INIT_SCRIPT" stop 2>/dev/null || true
|
||||
"$INIT_SCRIPT" disable 2>/dev/null || true
|
||||
rm -f "$INIT_SCRIPT"
|
||||
}
|
||||
|
||||
if [ -f "$INIT_SCRIPT" ] && "$INIT_SCRIPT" running 2>/dev/null; then
|
||||
PAGER_IP=$(get_pager_ip)
|
||||
LOG "green" "Mark VIII service is running"
|
||||
@@ -53,14 +83,26 @@ if [ -f "$INIT_SCRIPT" ] && "$INIT_SCRIPT" running 2>/dev/null; then
|
||||
resp=$(CONFIRMATION_DIALOG "Stop service?")
|
||||
if user_confirmed "$resp"; then
|
||||
LOG "yellow" "Stopping service..."
|
||||
"$INIT_SCRIPT" stop
|
||||
"$INIT_SCRIPT" disable
|
||||
rm -f "$INIT_SCRIPT"
|
||||
LOG "cyan" "Service stopped"
|
||||
remove_boot_service
|
||||
if ! wait_for_server_stop 12; then
|
||||
LOG "red" "Service is still listening on port $PORT"
|
||||
exit 1
|
||||
fi
|
||||
LOG "cyan" "Service stopped and removed from boot"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f "$INIT_SCRIPT" ] && "$INIT_SCRIPT" enabled 2>/dev/null; then
|
||||
LOG "yellow" "Mark VIII boot service is installed but not running"
|
||||
resp=$(CONFIRMATION_DIALOG "Remove boot service?")
|
||||
if user_confirmed "$resp"; then
|
||||
remove_boot_service
|
||||
LOG "cyan" "Boot service removed"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
AUTO_MODE=$(PAYLOAD_GET_CONFIG pager_webui auto_mode 2>/dev/null)
|
||||
RUN_MODE=$(PAYLOAD_GET_CONFIG pager_webui run_mode 2>/dev/null)
|
||||
|
||||
@@ -83,8 +125,15 @@ if user_confirmed "$resp"; then
|
||||
cp "$SCRIPT_DIR/pagerwebui.init" "$INIT_SCRIPT"
|
||||
chmod +x "$INIT_SCRIPT"
|
||||
"$INIT_SCRIPT" enable
|
||||
"$INIT_SCRIPT" start
|
||||
sleep 1
|
||||
if ! "$INIT_SCRIPT" start; then
|
||||
LOG "red" "Service start command failed"
|
||||
exit 1
|
||||
fi
|
||||
if ! wait_for_server 90; then
|
||||
remove_boot_service
|
||||
LOG "red" "Service failed startup checks; inspect logread"
|
||||
exit 1
|
||||
fi
|
||||
PAGER_IP=$(get_pager_ip)
|
||||
LOG "green" "Service started!"
|
||||
LOG "green" "http://$PAGER_IP:$PORT"
|
||||
@@ -106,10 +155,10 @@ trap cleanup EXIT INT TERM
|
||||
[ ! -f "$SCRIPT_DIR/server.py" ] && { LOG "red" "server.py not found!"; exit 1; }
|
||||
python3 "$SCRIPT_DIR/server.py" >/tmp/pagerwebui.log 2>&1 &
|
||||
echo $! > "$PID_FILE"
|
||||
sleep 1
|
||||
|
||||
PAGER_IP=$(get_pager_ip)
|
||||
if [ -f "$PID_FILE" ] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
|
||||
if wait_for_server 90 && [ -f "$PID_FILE" ] &&
|
||||
kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
|
||||
LOG "green" "http://$PAGER_IP:$PORT"
|
||||
LOG ""
|
||||
LOG "magenta" "Press B to stop"
|
||||
|
||||
Reference in New Issue
Block a user