From d052a87cc3219a665165f609bcae858813cf66ea Mon Sep 17 00:00:00 2001 From: eXtremeSHOK Date: Tue, 20 Feb 2018 10:31:01 +0200 Subject: [PATCH] Support for alpine linux rebased on dev replaces #1047 --- update.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/update.sh b/update.sh index ceb4311c..fba5da72 100755 --- a/update.sh +++ b/update.sh @@ -1,10 +1,13 @@ #!/bin/bash +#exit on error and pipefail +set -o errexit +set -o pipefail + for bin in curl docker-compose docker git awk sha1sum; do if [[ -z $(which ${bin}) ]]; then echo "Cannot find ${bin}, exiting..."; exit 1; fi done -set -o pipefail export LC_ALL=C DATE=$(date +%Y-%m-%d_%H_%M_%S) BRANCH=$(git rev-parse --abbrev-ref HEAD) @@ -30,6 +33,9 @@ done [[ ! -f mailcow.conf ]] && { echo "mailcow.conf is missing"; exit 1;} +if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then echo "BusybBox grep detected, please install gnu grep, \"apk add --no-cache --upgrade grep\""; exit 1; fi +if cp --help 2>&1 | head -n 1 | grep -q -i "busybox"; then echo "BusybBox cp detected, please install coreutils, \"apk add --no-cache --upgrade coreutils\""; exit 1; fi + CONFIG_ARRAY=( "SKIP_LETS_ENCRYPT" "USE_WATCHDOG" @@ -118,7 +124,7 @@ curl -o /dev/null google.com -sm3 if [[ $? != 0 ]]; then echo -e "\e[31mfailed\e[0m" exit 1 - else +else echo -e "\e[32mOK\e[0m" fi @@ -135,7 +141,7 @@ fi if [[ -f mailcow.conf ]]; then source mailcow.conf - else +else echo -e "\e[31mNo mailcow.conf - is mailcow installed?\e[0m" exit 1 fi @@ -183,11 +189,14 @@ fi echo -e "\e[32mFetching new docker-compose version...\e[0m" sleep 2 -if [[ $(curl -sL -w "%{http_code}" https://www.servercow.de/docker-compose/latest.php -o /dev/null) == "200" ]]; then +if [[ ! -z $(which pip) && $(pip list --local | 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) curl -#L https://github.com/docker/compose/releases/download/${LATEST_COMPOSE}/docker-compose-$(uname -s)-$(uname -m) > $(which docker-compose) chmod +x $(which docker-compose) - else +else echo -e "\e[33mCannot determine latest docker-compose version, skipping...\e[0m" fi @@ -239,7 +248,7 @@ if [[ ! -z ${IMGS_TO_DELETE[*]} ]]; then read -r -p "Do you want to delete old image tags right now? [y/N] " response if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then docker rmi ${IMGS_TO_DELETE[*]} - else + else echo "OK, skipped." fi fi