From 845ef5d076f1bcad1e03e1df803bef6a0c91c7b3 Mon Sep 17 00:00:00 2001 From: liph Date: Wed, 25 Feb 2026 10:35:13 +0100 Subject: [PATCH] updated podup scritp --- scripts/scripts/podman-update.sh | 34 +++++++++++++++++++------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/scripts/scripts/podman-update.sh b/scripts/scripts/podman-update.sh index 3e5c685..301c9d4 100755 --- a/scripts/scripts/podman-update.sh +++ b/scripts/scripts/podman-update.sh @@ -1,11 +1,10 @@ #!/bin/bash -# 1. Configuration: List the folder names you wish to EXCLUDE from updates. -# Separate names with a space. Example: EXCLUDED_FOLDERS=("ai-stack" "testing") -EXCLUDED_FOLDERS=("ai","dns-adguard","dns-pihole","immich") +# 1. Configuration: LIST OF EXCLUDED FOLDERS +# NOTE: Items must be separated by SPACES, not commas. +EXCLUDED_FOLDERS=("ai" "dns-adguard" "dns-pihole" "immich") -# 2. Set the base directory to the current location where the script is run. -# This assumes you place the script inside your /podman folder. +# 2. Set the base directory to the current script location BASE_DIR="." echo "========================================" @@ -16,17 +15,25 @@ echo "========================================" # 3. Loop through all directories in the base directory for dir in "$BASE_DIR"/*/; do - # Extract just the folder name (e.g., /podman/essential/ -> "essential") + # Extract just the folder name folder_name=$(basename "$dir") - # Check if this folder is in the exclusion list - # [[ " ${array[@]} " =~ " ${value} " ]] is a bash pattern matching trick - if [[ " ${EXCLUDED_FOLDERS[@]} " =~ " ${folder_name} " ]]; then + # --- NEW SAFER EXCLUSION LOGIC --- + skip_folder=0 + for excluded in "${EXCLUDED_FOLDERS[@]}"; do + if [[ "$folder_name" == "$excluded" ]]; then + skip_folder=1 + break + fi + done + + if [ "$skip_folder" -eq 1 ]; then echo "[SKIPPING] Excluded folder found: $folder_name" continue fi + # --------------------------------- - # Check if docker-compose.yml exists in this folder + # Check if docker-compose.yml exists if [ -f "$dir/docker-compose.yml" ]; then echo "" echo "[PROCESSING] Updating stack in: $folder_name" @@ -42,8 +49,8 @@ for dir in "$BASE_DIR"/*/; do podman-compose pull # Force recreate and restart containers - # -d: Detached mode (run in background) - # --force-recreate: Stops and recreates containers even if config hasn't changed + # -d: Detached mode + # --force-recreate: Stops and recreates containers echo " -> Force restarting services..." podman-compose up -d --force-recreate @@ -52,8 +59,7 @@ for dir in "$BASE_DIR"/*/; do echo "[FINISHED] $folder_name updated." else - # Optional: Silence this if you have many non-compose folders - echo "[IGNORE] No docker-compose.yml found in $folder_name" + echo "[IGNORE] No compose file found in $folder_name" fi done