From f6a41daffa366ff9f4d91f37d28e4755d7ae48cf Mon Sep 17 00:00:00 2001 From: andryyy Date: Fri, 29 May 2020 19:47:44 +0200 Subject: [PATCH] [Update] Allow to skip fetching docker-compose --- update.sh | 55 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/update.sh b/update.sh index 3524a1b1..b31c667f 100755 --- a/update.sh +++ b/update.sh @@ -150,14 +150,19 @@ while (($#)); do echo -e "\e[32mForcing Update...\e[0m" FORCE=y ;; + --no-update-compose) + NO_UPDATE_COMPOSE=y + ;; --help|-h) echo './update.sh [-c|--check, --ours, --gc, --skip-start, -h|--help] - -c|--check - Check for updates and exit (exit codes => 0: update available, 3: no updates) - --ours - Use merge strategy "ours" to solve conflicts in favor of non-mailcow code (local changes) - --gc - Run garbage collector to delete old image tags - --skip-start - Do not start mailcow after update - -f|--force - Force update, do not ask questions + -c|--check - Check for updates and exit (exit codes => 0: update available, 3: no updates) + --ours - Use merge strategy "ours" to solve conflicts in favor of non-mailcow code (local changes) + --gc - Run garbage collector to delete old image tags + --no-update-compose - Do not update docker-compose + --prefetch - Only prefetch new images and exit (useful to prepare updates) + --skip-start - Do not start mailcow after update + -f|--force - Force update, do not ask questions ' exit 1 esac @@ -467,25 +472,29 @@ elif [[ ${MERGE_RETURN} != 0 ]]; then exit 1 fi -echo -e "\e[32mFetching new docker-compose version...\e[0m" -sleep 2 -if [[ ! -z $(which pip) && $(pip list --local 2>&1 | grep -v DEPRECATION | grep -c docker-compose) == 1 ]]; then - true - #prevent breaking a working docker-compose installed with pip -elif [[ $(curl -sL -w "%{http_code}" https://www.servercow.de/docker-compose/latest.php -o /dev/null) == "200" ]]; then - LATEST_COMPOSE=$(curl -#L https://www.servercow.de/docker-compose/latest.php) - COMPOSE_VERSION=$(docker-compose version --short) - if [[ "$LATEST_COMPOSE" != "$COMPOSE_VERSION" ]]; then - COMPOSE_PATH=$(which docker-compose) - if [[ -w ${COMPOSE_PATH} ]]; then - curl -#L https://github.com/docker/compose/releases/download/${LATEST_COMPOSE}/docker-compose-$(uname -s)-$(uname -m) > $COMPOSE_PATH - chmod +x $COMPOSE_PATH - else - echo -e "\e[33mWARNING: $COMPOSE_PATH is not writable, but new version $LATEST_COMPOSE is available (installed: $COMPOSE_VERSION)\e[0m" - fi - fi +if [[ ${NO_UPDATE_COMPOSE} == "y" ]]; then + echo -e "\e[33mNot fetching latest docker-compose, please check for updates manually!\e[0m" else - echo -e "\e[33mCannot determine latest docker-compose version, skipping...\e[0m" + echo -e "\e[32mFetching new docker-compose version...\e[0m" + sleep 1 + if [[ ! -z $(which pip) && $(pip list --local 2>&1 | grep -v DEPRECATION | grep -c docker-compose) == 1 ]]; then + true + #prevent breaking a working docker-compose installed with pip + elif [[ $(curl -sL -w "%{http_code}" https://www.servercow.de/docker-compose/latest.php -o /dev/null) == "200" ]]; then + LATEST_COMPOSE=$(curl -#L https://www.servercow.de/docker-compose/latest.php) + COMPOSE_VERSION=$(docker-compose version --short) + if [[ "$LATEST_COMPOSE" != "$COMPOSE_VERSION" ]]; then + COMPOSE_PATH=$(which docker-compose) + if [[ -w ${COMPOSE_PATH} ]]; then + curl -#L https://github.com/docker/compose/releases/download/${LATEST_COMPOSE}/docker-compose-$(uname -s)-$(uname -m) > $COMPOSE_PATH + chmod +x $COMPOSE_PATH + else + echo -e "\e[33mWARNING: $COMPOSE_PATH is not writable, but new version $LATEST_COMPOSE is available (installed: $COMPOSE_VERSION)\e[0m" + fi + fi + else + echo -e "\e[33mCannot determine latest docker-compose version, skipping...\e[0m" + fi fi echo -e "\e[32mFetching new images, if any...\e[0m"