Clear the onboard phase flags on offboard, and let the mirror signal the owner before revoking the key it signals with

This commit is contained in:
Gmer4Lfe
2026-08-17 05:44:35 -04:00
parent fe58fb7826
commit bdc2cdbadb
2 changed files with 55 additions and 4 deletions
+16
View File
@@ -996,6 +996,22 @@ set_state_var() {
fi
}
# Removes a key from a flat state file. The inverse of set_state_var, and the reason it exists:
# onboarding writes HOST*_PHASE*_DONE and nothing took them away again, so a completed offboard
# left a state file reading INACTIVE beside flags still claiming a finished onboard. Anything
# reading the flags — the setup checklist, the partnership card — believed the torn-down
# partnership was live.
#
# Absent key is success, not an error: clearing twice is how a re-run after a partial teardown
# should behave.
# Usage: clear_state_var "$state_file" "$key"
clear_state_var() {
local file="$1" key="$2"
[[ -f "$file" ]] || return 0
grep -q "^${key}=" "$file" 2>/dev/null || return 0
sed -i "/^${key}=/d" "$file"
}
# ==============================================================================================
# ── CONNECTIVITY CHECKS ───────────────────────────────────────────────────────────────────────
# ==============================================================================================