Fix dead/incorrect vars and consolidate duplicated logic into common.sh
Codebase-wide audit pass: fixed real bugs (SSH hangs missing BatchMode, local-outside-function no-ops, variable name collisions, a truncated ratio calc, wrong state-dir path, DARK vs NO_INTERNET drift, and more), then pulled logic that was duplicated across multiple scripts — arr cleanup safety gates, docker restart ordering, container maintenance stop/restart, watchdog state-file helpers, partnership role resolution, cert expiry checks, remote node discovery, and TMDB discovery scoring — into common.sh so each now has a single implementation.
This commit is contained in:
@@ -53,7 +53,7 @@ parse_args "$@"
|
||||
detect_hosts
|
||||
require_partnership
|
||||
|
||||
RAM_CACHE="/tmp/.cache/vv/d"
|
||||
RAM_CACHE="$CONF_RAM_CACHE_DIR"
|
||||
SAVE_DIR="$PERSISTENT_CONF_CACHE"
|
||||
|
||||
[[ "$DRY_RUN" == true ]] && warn "DRY RUN — no changes will be made"
|
||||
@@ -67,7 +67,7 @@ restored=0
|
||||
for conf in "$SAVE_DIR"/host*.conf; do
|
||||
[[ -f "$conf" ]] || continue
|
||||
base="$(basename "$conf")"
|
||||
[[ "${base,,}" == "${MY_ID,,}.conf" ]] && continue
|
||||
is_own_conf_file "$base" && continue
|
||||
|
||||
if [[ -f "$RAM_CACHE/$base" ]]; then
|
||||
log "$base already in RAM cache (conf_sync succeeded) — skipping"
|
||||
|
||||
@@ -47,7 +47,7 @@ parse_args "$@"
|
||||
detect_hosts
|
||||
require_partnership
|
||||
|
||||
RAM_CACHE="/tmp/.cache/vv/d"
|
||||
RAM_CACHE="$CONF_RAM_CACHE_DIR"
|
||||
SAVE_DIR="$PERSISTENT_CONF_CACHE"
|
||||
|
||||
[[ "$DRY_RUN" == true ]] && warn "DRY RUN — no files will be written"
|
||||
@@ -61,7 +61,7 @@ saved=0
|
||||
for conf in "$RAM_CACHE"/host*.conf; do
|
||||
[[ -f "$conf" ]] || continue
|
||||
base="$(basename "$conf")"
|
||||
[[ "${base,,}" == "${MY_ID,,}.conf" ]] && continue
|
||||
is_own_conf_file "$base" && continue
|
||||
|
||||
if [[ "$DRY_RUN" == true ]]; then
|
||||
warn "DRY RUN — would save $base → $SAVE_DIR/"
|
||||
|
||||
@@ -81,7 +81,7 @@ if [[ "${CONF_SYNC_ENABLED:-true}" == false ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CACHE_DIR="/tmp/.cache/vv/d"
|
||||
CACHE_DIR="$CONF_RAM_CACHE_DIR"
|
||||
MY_CONF="$SCRIPTS_DIR/Configurations/${MY_ID,,}.conf"
|
||||
SSH_TIMEOUT=10
|
||||
|
||||
|
||||
Reference in New Issue
Block a user