diff --git a/scripts/install.sh b/scripts/install.sh index 5eba151..92c688f 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -410,6 +410,18 @@ write_service() { enable_and_start() { if [ -x "$OPENWRT_INIT_PATH" ] && { [ -x /sbin/procd ] || [ -x /sbin/ubusd ]; }; then "$OPENWRT_INIT_PATH" enable + # Stop explicitly before restart. Some procd/rc.common variants return + # from restart while the previous process is still inside its bounded + # VoWiFi cleanup, so the replacement can race the host-wide instance + # lock and enter a respawn cycle. + "$OPENWRT_INIT_PATH" stop || true + local stop_attempt + for stop_attempt in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40; do + if ! "$OPENWRT_INIT_PATH" running; then + break + fi + sleep 1 + done if "$OPENWRT_INIT_PATH" restart; then # Modems may need several seconds to release and reopen their AT # port after procd stops the previous process. Require consecutive