updated podup scritp

This commit is contained in:
liph
2026-02-25 10:35:13 +01:00
parent 07d8051731
commit 845ef5d076

View File

@@ -1,11 +1,10 @@
#!/bin/bash #!/bin/bash
# 1. Configuration: List the folder names you wish to EXCLUDE from updates. # 1. Configuration: LIST OF EXCLUDED FOLDERS
# Separate names with a space. Example: EXCLUDED_FOLDERS=("ai-stack" "testing") # NOTE: Items must be separated by SPACES, not commas.
EXCLUDED_FOLDERS=("ai","dns-adguard","dns-pihole","immich") EXCLUDED_FOLDERS=("ai" "dns-adguard" "dns-pihole" "immich")
# 2. Set the base directory to the current location where the script is run. # 2. Set the base directory to the current script location
# This assumes you place the script inside your /podman folder.
BASE_DIR="." BASE_DIR="."
echo "========================================" echo "========================================"
@@ -16,17 +15,25 @@ echo "========================================"
# 3. Loop through all directories in the base directory # 3. Loop through all directories in the base directory
for dir in "$BASE_DIR"/*/; do 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") folder_name=$(basename "$dir")
# Check if this folder is in the exclusion list # --- NEW SAFER EXCLUSION LOGIC ---
# [[ " ${array[@]} " =~ " ${value} " ]] is a bash pattern matching trick skip_folder=0
if [[ " ${EXCLUDED_FOLDERS[@]} " =~ " ${folder_name} " ]]; then 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" echo "[SKIPPING] Excluded folder found: $folder_name"
continue continue
fi fi
# ---------------------------------
# Check if docker-compose.yml exists in this folder # Check if docker-compose.yml exists
if [ -f "$dir/docker-compose.yml" ]; then if [ -f "$dir/docker-compose.yml" ]; then
echo "" echo ""
echo "[PROCESSING] Updating stack in: $folder_name" echo "[PROCESSING] Updating stack in: $folder_name"
@@ -42,8 +49,8 @@ for dir in "$BASE_DIR"/*/; do
podman-compose pull podman-compose pull
# Force recreate and restart containers # Force recreate and restart containers
# -d: Detached mode (run in background) # -d: Detached mode
# --force-recreate: Stops and recreates containers even if config hasn't changed # --force-recreate: Stops and recreates containers
echo " -> Force restarting services..." echo " -> Force restarting services..."
podman-compose up -d --force-recreate podman-compose up -d --force-recreate
@@ -52,8 +59,7 @@ for dir in "$BASE_DIR"/*/; do
echo "[FINISHED] $folder_name updated." echo "[FINISHED] $folder_name updated."
else else
# Optional: Silence this if you have many non-compose folders echo "[IGNORE] No compose file found in $folder_name"
echo "[IGNORE] No docker-compose.yml found in $folder_name"
fi fi
done done