#!/bin/sh # v46.1 UI-only rollback watchdog # - Removes ONLY the preview IPKs (luci-theme-argon, luci-app-argon-config, luci-i18n-argon-config-zh-cn, luci-app-wgtunnel, luci-app-tr3000-status) # - Restores /luci-static/bootstrap as the active theme # - Clears /tmp/luci-cache and the WG apply state directory # - Restarts rpcd + uhttpd only. Does NOT touch network / firewall / Wi-Fi / WG / VXLAN. # - Does NOT call opkg update or fetch anything from the network. Bootstrap is # already part of the v46 image; we only flip mediaurlbase to it. set -eu PREVIEW_LUCI=" luci-theme-argon luci-app-argon-config luci-i18n-argon-config-zh-cn luci-app-wgtunnel luci-app-tr3000-status " # 1. Switch active theme to bootstrap (already present in the v46 image) uci set luci.main.mediaurlbase=/luci-static/bootstrap uci commit luci # 2. Drop any in-memory Argon config so the admin does not "see" an empty form uci -q delete argon.@global[0] 2>/dev/null || true uci commit argon 2>/dev/null || true # 3. Clean LuCI cache rm -rf /tmp/luci-cache /tmp/luci-indexcache 2>/dev/null || true rm -rf /www/luci-static/argon/background 2>/dev/null || true mkdir -p /www/luci-static/argon/background chmod 0755 /www/luci-static/argon/background # 4. Clear the WG apply state directory (token / snapshot / lock). It is a # DIRECTORY created by luci.wgtunnel, not a file. rm -rf /tmp/luci-wgtunnel 2>/dev/null || true # 5. Remove preview IPKs only for pkg in $PREVIEW_LUCI; do if opkg list-installed | awk '{print $1}' | grep -qx "$pkg"; then opkg remove --autoremove "$pkg" || true fi done # 6. Restart only web/rpcd - never network, never firewall, never wifi /etc/init.d/rpcd restart >/dev/null 2>&1 || true /etc/init.d/uhttpd restart >/dev/null 2>&1 || true echo "v46.1 UI rollback watchdog: done; theme bootstrap, preview IPKs removed, web stack restarted"