Merge pull request #1071 from extremeshok/patch-9

Support for alpine linux
This commit is contained in:
André Peters 2018-02-23 11:12:58 +01:00 committed by GitHub
commit d9e458daee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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