Disarm on offboard every sync gate onboard arms, with the same helper, so the two are one operation in both directions

This commit is contained in:
Gmer4Lfe
2026-08-16 21:36:46 -04:00
parent 3ae6298656
commit 27989d066e
4 changed files with 103 additions and 46 deletions
+2 -28
View File
@@ -254,32 +254,6 @@ write_onboard_phase() {
platform_push_setup_state
}
# ── Helper: set a boolean toggle in master.conf, in place ─────────────────────────────────────
# Booleans only. The value pattern stops at whitespace, so a quoted value containing spaces would
# be truncated — every gate this arms is true/false and nothing else should use it.
#
# Preserves what the line already looks like: leading indent, the existing quoting style, and the
# column the trailing comment sits in. master.conf is hand-aligned and read by a person; an edit
# that reflows a line makes a diff that looks bigger than the change actually is.
_arm_conf_var() {
local key="$1" val="$2" file="$3" cur pad spaces quoted
if ! grep -qE "^[[:space:]]*${key}=" "$file"; then
warn " ${key} is not in master.conf — skipped (add it to the template first)"
return 1
fi
cur=$(grep -E "^[[:space:]]*${key}=" "$file" | head -1 | sed -E "s|^[[:space:]]*${key}=||; s|[[:space:]]*#.*$||")
quoted=""; [[ "$cur" == \"*\" ]] && quoted='"'
cur="${cur//\"/}"
[[ "$cur" == "$val" ]] && { echo " ${key} already ${val}"; return 0; }
# Pad only when a comment follows — otherwise a shorter value leaves trailing whitespace.
pad=0
if grep -qE "^[[:space:]]*${key}=[^#]*#" "$file"; then
pad=$(( ${#cur} - ${#val} )); (( pad < 0 )) && pad=0
fi
spaces=$(printf '%*s' "$pad" '')
sed -i -E "s|^([[:space:]]*)${key}=[^#[:space:]]*([[:space:]]*)(#.*)?$|\1${key}=${quoted}${val}${quoted}${spaces}\2\3|" "$file"
echo " ${key}: ${cur}${val}"
}
echo ""
echo "━━━ $ICON_FALLBACK Partnership Onboard — $MY_ID ($LOCAL_SERVER_NAME) — $(date '+%Y-%m-%d %H:%M:%S') ━━━"
@@ -635,7 +609,7 @@ if [[ "$PHASE1_ONLY" == true ]]; then
elif [[ ! -f "$_conf_sync_script" ]]; then
warn "conf_sync.sh not found — skipping partner conf cache"
else
_arm_conf_var CONF_SYNC_ENABLED "true" "$SCRIPTS_ROOT/Configurations/master.conf" \
set_conf_bool CONF_SYNC_ENABLED "true" "$SCRIPTS_ROOT/Configurations/master.conf" \
|| warn "Could not arm CONF_SYNC_ENABLED — cache step may no-op"
if bash "$_conf_sync_script" --push-only; then
@@ -920,7 +894,7 @@ else
else
cp -a "$_master_conf" "${_master_conf}.bak-arm-$(date +%Y%m%d-%H%M%S)"
for _gate in RSYNC_ENABLED CONF_SYNC_ENABLED ARR_SYNC_ENABLED; do
_arm_conf_var "$_gate" "true" "$_master_conf" || ARM_OK=false
set_conf_bool "$_gate" "true" "$_master_conf" || ARM_OK=false
done
# Tier 1 is now open, so say what that actually turned on rather than leaving it implied.
echo " rsync tier 2 gates were left as configured — check them before the first run"