From 0cf6b66b63b6935c32d5493f2dd3eb8fe11588da Mon Sep 17 00:00:00 2001 From: poslop Date: Thu, 9 Apr 2026 10:46:46 -0500 Subject: [PATCH] added update flag to run script --- scripts/run-all.sh | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/scripts/run-all.sh b/scripts/run-all.sh index c8ce6aa..b6fc4c0 100755 --- a/scripts/run-all.sh +++ b/scripts/run-all.sh @@ -34,6 +34,24 @@ services=( "pterodactyl/docker-compose.yml" ) +# Initialize update flag +UPDATE=false + +# Parse command line arguments +while [[ $# -gt 0 ]]; do + case $1 in + -u|--update) + UPDATE=true + shift + ;; + *) + echo "Unknown option: $1" + echo "Usage: $0 [-u|--update]" + exit 1 + ;; + esac +done + # Start building the docker compose command with multiple -f flags COMPOSE_COMMAND="docker compose --env-file \"$ENV_FILE\"" @@ -42,10 +60,23 @@ for service in "${services[@]}"; do COMPOSE_COMMAND+=" -f \"$COMPOSE_DIR/$service\"" done +# If update flag is set, pull all images first +if $UPDATE; then + COMPOSE_UPDATE_COMMAND="$COMPOSE_COMMAND pull" + echo "Pulling latest images..." + eval $COMPOSE_UPDATE_COMMAND + echo "Images pulled successfully." + echo "" +fi + # Add the up command to the final docker compose command COMPOSE_COMMAND+=" --profile panel --profile daemon up -d --remove-orphans" # Execute the composed command eval $COMPOSE_COMMAND -echo "All services have been started." +if $UPDATE; then + echo "All containers have been updated and started." +else + echo "All services have been started." +fi