From 35707a4191f7ec1f3f0c53f146926ec9ec5aaad0 Mon Sep 17 00:00:00 2001 From: FailedProxy Date: Mon, 4 May 2026 18:03:51 -0400 Subject: [PATCH] common var fix --- Notes_To-Do.md | 4 ++-- common.sh | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Notes_To-Do.md b/Notes_To-Do.md index 3647d36..03224ed 100644 --- a/Notes_To-Do.md +++ b/Notes_To-Do.md @@ -5,7 +5,7 @@ claude -arrs system error, can we delete movies from lidar when dropped from tmdb, 99% of the time its future movies that get dropped +arrs system error, can we delete movies from radar when dropped from tmdb, 99% of the time its future movies that get dropped movie Silent Hill 2: The Movie (tmdbid 466226) was removed from TMDb @@ -22,7 +22,7 @@ later. . add a script to check all docker containers and update any that still need it to run after the containers that get synced and updated. - +. add a script to find missing artist and album cover from fanart and itunes, or itunes as a fallback diff --git a/common.sh b/common.sh index ce0be4e..ac1d1ed 100644 --- a/common.sh +++ b/common.sh @@ -463,8 +463,8 @@ detect_hosts() { fi # ── Set scalar aliases ──────────────────────────────────────────────────── - MY_DISCORD_WEBHOOK="${!MY_ID}_DISCORD_WEBHOOK" - MY_DISCORD_WEBHOOK="${!MY_DISCORD_WEBHOOK:-}" + MY_DISCORD_WEBHOOK_VAR="${MY_ID}_DISCORD_WEBHOOK" + MY_DISCORD_WEBHOOK="${!MY_DISCORD_WEBHOOK_VAR:-}" EMBY_CONTAINER_VAR="${MY_ID}_EMBY_CONTAINER" EMBY_CONTAINER="${!EMBY_CONTAINER_VAR:-}" @@ -563,14 +563,14 @@ detect_hosts() { _alias_assoc() { local alias_name="$1" - local source_var="${MY_ID}_${alias_name}" - # Declare the alias as associative + local source_name="${MY_ID}_${alias_name}" eval "declare -gA ${alias_name}" - # Copy each key from source to alias - local key - eval "for key in \"\${!${source_var}[@]:-}\"; do - eval \"${alias_name}[\\\"\$key\\\"]=\\\"\${${source_var}[\\\"\$key\\\"]}\\\"\" - done" + local -n _assoc_src="${source_name}" 2>/dev/null || return 0 + local -n _assoc_dst="${alias_name}" + local _assoc_key + for _assoc_key in "${!_assoc_src[@]}"; do + _assoc_dst["$_assoc_key"]="${_assoc_src[$_assoc_key]}" + done } _alias_assoc "WATCHDOG_CONTAINERS" @@ -1580,7 +1580,8 @@ check_unraid_version_parity() { fi # Read remote version via SSH - remote_version=$(ssh -i "$SSH_KEY" -o ConnectTimeout=10 root@"$REMOTE_SERVER" "grep -oP '(?<=version=")[^"]+' /etc/unraid-version 2>/dev/null" 2>/dev/null) + remote_version=$(ssh -i "$SSH_KEY" -o ConnectTimeout=10 root@"$REMOTE_SERVER" \ + "grep -oP '(?<=version=\")[^\"]+' /etc/unraid-version 2>/dev/null" 2>/dev/null) if [[ -z "$remote_version" ]]; then warn "Cannot read remote unRAID version from $REMOTE_SERVER_NAME — skipping parity check" return 0