From c8ccf080f314fc09a1c6e1458f07658e06e675c3 Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 14 Jul 2022 20:01:38 +0200 Subject: [PATCH 1/3] Add Integration Tests badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7f7907d2..313fa13b 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ## We stand with 🇺🇦 +[![Mailcow Integration Tests](https://github.com/mailcow/mailcow-dockerized/actions/workflows/integration_tests.yml/badge.svg?branch=master)](https://github.com/mailcow/mailcow-dockerized/actions/workflows/integration_tests.yml) [![Translation status](https://translate.mailcow.email/widgets/mailcow-dockerized/-/translation/svg-badge.svg)](https://translate.mailcow.email/engage/mailcow-dockerized/) [![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/mailcow_email.svg?style=social&label=Follow%20%40mailcow_email)](https://twitter.com/mailcow_email) From 7aab2c55ff4f7286b0efd7409a13e9298b73705b Mon Sep 17 00:00:00 2001 From: DerLinkman Date: Fri, 15 Jul 2022 10:30:01 +0200 Subject: [PATCH 2/3] Changed which to command -v + seperated compose check from for loop --- update.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/update.sh b/update.sh index cd9d4fb6..3184579f 100755 --- a/update.sh +++ b/update.sh @@ -203,7 +203,7 @@ else DC_DL_SUFFIX=legacy fi sleep 1 - if [[ $(which pip 2>&1) && $(pip list --local 2>&1 | grep -v DEPRECATION | grep -c docker-compose) == 1 || $(which pip3 2>&1) && $(pip3 list --local 2>&1 | grep -v DEPRECATION | grep -c docker-compose) == 1 ]]; then + if [[ $(command -v pip 2>&1) && $(pip list --local 2>&1 | grep -v DEPRECATION | grep -c docker-compose) == 1 || $(command -v pip3 2>&1) && $(pip3 list --local 2>&1 | grep -v DEPRECATION | grep -c docker-compose) == 1 ]]; then echo -e "\e[33mFound a docker-compose Version installed with pip!\e[0m" echo -e "\e[31mPlease uninstall the pip Version of docker-compose since it doesn´t support Versions higher than 1.29.2.\e[0m" sleep 2 @@ -214,7 +214,7 @@ else 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) + COMPOSE_PATH=$(command -v docker-compose) if [[ -w ${COMPOSE_PATH} ]]; then curl -#L https://github.com/docker/compose/releases/download/v${LATEST_COMPOSE}/docker-compose-$(uname -s)-$(uname -m) > $COMPOSE_PATH chmod +x $COMPOSE_PATH @@ -273,16 +273,18 @@ PATH=$PATH:/opt/bin umask 0022 for bin in curl docker git awk sha1sum; do - if [[ -z $(which ${bin}) ]]; then + if [[ -z $(command -v ${bin}) ]]; then echo "Cannot find ${bin}, exiting..." exit 1; - elif [[ -z $(which docker-compose) ]]; then + fi +done + +if [[ -z $(command -v docker-compose) ]]; then echo -e "\e[31mCannot find docker-compose Standalone.\e[0m" echo -e "\e[31mPlease install it manually regarding to this doc site: https://mailcow.github.io/mailcow-dockerized-docs/i_u_m/i_u_m_install/\e[0m" sleep 3 exit 1; - fi -done +fi ## Check if docker-compose >= v2 if ! docker-compose version --short | grep "^2." > /dev/null 2>&1; then From ceaf1423f4a7d9e4beb99c3b3280600f1265687c Mon Sep 17 00:00:00 2001 From: DerLinkman Date: Mon, 18 Jul 2022 10:39:17 +0200 Subject: [PATCH 3/3] Moved general compose v2 check below the parameter section to respect --force --- update.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/update.sh b/update.sh index 3184579f..6659de55 100755 --- a/update.sh +++ b/update.sh @@ -286,21 +286,6 @@ if [[ -z $(command -v docker-compose) ]]; then exit 1; fi -## Check if docker-compose >= v2 -if ! docker-compose version --short | grep "^2." > /dev/null 2>&1; then - echo -e "\e[33mYour docker-compose Version is not up to date!\e[0m" - echo -e "\e[33mmailcow needs docker-compose > 2.X.X!\e[0m" - echo -e "\e[33mYour current installed Version: $(docker-compose version --short)\e[0m" - sleep 3 - update_compose - if [[ ! "${updatecomposeresponse}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then - echo -e "\e[31mmailcow does not work with docker-compose < 2.X.X anymore!\e[0m" - echo -e "\e[31mPlease update your docker-compose manually, to run mailcow.\e[0m" - echo -e "\e[31mExiting...\e[0m" - exit 1 - fi -fi - export LC_ALL=C DATE=$(date +%Y-%m-%d_%H_%M_%S) BRANCH=$(cd ${SCRIPT_DIR}; git rev-parse --abbrev-ref HEAD) @@ -380,6 +365,21 @@ while (($#)); do shift done +# Check if Docker-Compose is older then v2 before continuing +if ! docker-compose version --short | grep "^2." > /dev/null 2>&1; then + echo -e "\e[33mYour docker-compose Version is not up to date!\e[0m" + echo -e "\e[33mmailcow needs docker-compose > 2.X.X!\e[0m" + echo -e "\e[33mYour current installed Version: $(docker-compose version --short)\e[0m" + sleep 3 + update_compose + if [[ ! "${updatecomposeresponse}" =~ ^([yY][eE][sS]|[yY])+$ ]] && [[ ! ${FORCE} ]]; then + echo -e "\e[31mmailcow does not work with docker-compose < 2.X.X anymore!\e[0m" + echo -e "\e[31mPlease update your docker-compose manually, to run mailcow.\e[0m" + echo -e "\e[31mExiting...\e[0m" + exit 1 + fi +fi + [[ ! -f mailcow.conf ]] && { echo "mailcow.conf is missing"; exit 1;} chmod 600 mailcow.conf source mailcow.conf