feat: startup environment check + self-heal (v1.3)

- env_check(): verifies daemon/pineapd/UCI/monitors/recon DB, auto-fixes
  fixable issues and re-verifies; forces runtime SSID-pool broadcast off to
  match the UI (kills the 'pool on but UI shows off' gap)
- server.py --env-check CLI; payload.sh runs it verbosely before starting,
  aborts on core failure
- serve() runs the check at every startup (boot + procd respawn)
- /api/health exposes env report + pool_runtime; /api/recon/status exposes
  wlan0_pinned (2.4GHz under-sampling warning); recon page warns when a
  radio0 AP pins wlan0mon
- recon start failures now include the daemon reason in the UI error
- shared stabilization refactor (_stabilize_uci/PINEAPD_SAFE_UCI/_raise_monitors)
- tests: test_env_check.py (18) + health/recon updates
This commit is contained in:
2026-08-19 10:25:02 -05:00
parent 37b5e821dd
commit 904843307e
8 changed files with 468 additions and 28 deletions
@@ -2,7 +2,7 @@
# Title: Mark VIII
# Description: Mark VII-style web management UI for the WiFi Pineapple Pager
# Author: c4ch3c4d3
# Version: 1.1
# Version: 1.3
# 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.1 |"
LOG "cyan" "| Mark VIII v1.3 |"
LOG "cyan" "+---------------------------+"
if ! command -v python3 >/dev/null 2>&1; then
@@ -36,6 +36,16 @@ if ! command -v python3 >/dev/null 2>&1; then
exit 1
fi
run_env_check() {
LOG "cyan" "Running environment check..."
if ! python3 "$SCRIPT_DIR/server.py" --env-check; then
LOG "red" "Environment check FAILED. Fix the issues above and re-run the payload."
sleep 3
exit 1
fi
LOG "green" "Environment check passed."
}
if [ -f "$INIT_SCRIPT" ] && "$INIT_SCRIPT" running 2>/dev/null; then
PAGER_IP=$(get_pager_ip)
LOG "green" "Mark VIII service is running"
@@ -67,6 +77,7 @@ else
fi
if user_confirmed "$resp"; then
run_env_check
LOG "cyan" "Starting as background service..."
[ ! -f "$SCRIPT_DIR/server.py" ] && { LOG "red" "server.py not found!"; exit 1; }
cp "$SCRIPT_DIR/pagerwebui.init" "$INIT_SCRIPT"
@@ -82,6 +93,7 @@ if user_confirmed "$resp"; then
exit 0
fi
run_env_check
LOG "cyan" "Starting foreground mode..."
cleanup() {
LOG "yellow" "Stopping Mark VIII..."