updated podup scritp
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user