Add parameters handling to update-all script

This commit is contained in:
Jean Froment 2021-06-07 13:59:28 +02:00
parent 309b89864f
commit 4ed6b00440
1 changed files with 20 additions and 3 deletions

View File

@ -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
@ -16,8 +30,11 @@ 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 *****"