From 4ed6b00440763ae4406f028f774e568da5f0e418 Mon Sep 17 00:00:00 2001 From: Jean Froment Date: Mon, 7 Jun 2021 13:59:28 +0200 Subject: [PATCH] Add parameters handling to update-all script --- update-all.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/update-all.sh b/update-all.sh index 8e4b476..406d5ea 100755 --- a/update-all.sh +++ b/update-all.sh @@ -1,5 +1,19 @@ #!/bin/bash +SKIP_PULL=0 + +for i in "$@"; do + case $i in + --no-pull) + SKIP_PULL=1 + ;; + *) + echo "[$0] ❌ ERROR: unknown parameter \"$i\"" + exit 1 + ;; + esac +done + # Create/update http_auth file according to values in .env file source .env echo "${HTTP_USER}:${HTTP_PASSWORD}" > traefik/http_auth @@ -10,14 +24,17 @@ COMPOSE_HTTP_TIMEOUT=240 # Fetch all YAML files disabled_pattern="" while read -r line ; do - disabled_pattern="${disabled_pattern} ! -name $line.yaml" + disabled_pattern="${disabled_pattern} ! -name $line.yaml" done < <(grep "disable" services.conf | awk -F : '{print $1}' ) SERVICES=$(find services -mindepth 1 -maxdepth 1 -name "*.yaml" ${disabled_pattern} | sed -e 's/^/-f /') ALL_SERVICES="-f docker-compose.yaml $SERVICES" -echo "[$0] ***** Pulling all images... *****" -docker-compose ${ALL_SERVICES} pull +if [[ "${SKIP_PULL}" != "1" ]]; then + echo "[$0] ***** Pulling all images... *****" + docker-compose ${ALL_SERVICES} pull +fi + echo "[$0] ***** Recreating containers if required... *****" docker-compose ${ALL_SERVICES} up -d --remove-orphans echo "[$0] ***** Done updating containers *****"