1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2024-12-25 02:29:32 +02:00

Optimized if-else arguments and outputs

This commit is contained in:
DerLinkman 2022-06-07 14:45:19 +02:00
parent 958112af6b
commit 74baf20feb
4 changed files with 27 additions and 24 deletions

View File

@ -30,12 +30,12 @@ for bin in openssl curl docker git awk sha1sum; do
done done
echo "checking docker compose version..."; echo "checking docker compose version...";
if docker --help | grep compose; then if docker compose >/dev/null 2>&1; then
echo '' echo -e "\e[32mFound Compose v2!\e[0m"
elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then
echo -e "\e[31mWARN: Your machine is using Docker-Compose v1!\e[0m" echo -e "\e[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
echo -e "\e[31mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m" echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
echo -e "\e[31mPlease consider a upgrade to Docker-Compose v2.\e[0m" echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
echo echo
echo echo
echo -e "\e[33mContinuing...\e[0m" echo -e "\e[33mContinuing...\e[0m"

View File

@ -86,12 +86,12 @@ function preflight_local_checks() {
echo "checking docker compose version..."; echo "checking docker compose version...";
if docker --help | grep compose; then if docker compose >/dev/null 2>&1; then
echo '' echo -e "\e[32mFound Compose v2 on local machine!\e[0m"
elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then
echo -e "\e[31mWARN: Your machine is using Docker-Compose v1!\e[0m" echo -e "\e[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
echo -e "\e[31mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m" echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
echo -e "\e[31mPlease consider a upgrade to Docker-Compose v2.\e[0m" echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
echo echo
echo echo
echo -e "\e[33mContinuing...\e[0m" echo -e "\e[33mContinuing...\e[0m"
@ -144,16 +144,17 @@ function preflight_remote_checks() {
-i "${REMOTE_SSH_KEY}" \ -i "${REMOTE_SSH_KEY}" \
${REMOTE_SSH_HOST} \ ${REMOTE_SSH_HOST} \
-p ${REMOTE_SSH_PORT} \ -p ${REMOTE_SSH_PORT} \
-t docker --help | grep compose; then -t 'docker compose' >/dev/null 2>&1; then
echo -e "\e[32mFound Compose v2 on remote!\e[0m"
COMPOSE_COMMAND="docker compose" COMPOSE_COMMAND="docker compose"
elif ssh -q -o StrictHostKeyChecking=no \ elif ssh -q -o StrictHostKeyChecking=no \
-i "${REMOTE_SSH_KEY}" \ -i "${REMOTE_SSH_KEY}" \
${REMOTE_SSH_HOST} \ ${REMOTE_SSH_HOST} \
-p ${REMOTE_SSH_PORT} \ -p ${REMOTE_SSH_PORT} \
'docker-compose version --short' | grep -m1 "^1" > /dev/null 2>&1; then -t 'docker-compose version --short' | grep -m1 "^1" > /dev/null 2>&1; then
echo -e "\e[31mWARN: The remote is using Docker-Compose v1!\e[0m" echo -e "\e[33mWARN: The remote is using Docker-Compose v1!\e[0m"
echo -e "\e[31mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m" echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
echo -e "\e[31mPlease consider a upgrade to Docker-Compose v2 on remote.\e[0m" echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2 on remote.\e[0m"
echo echo
echo echo
echo -e "\e[33mContinuing...\e[0m" echo -e "\e[33mContinuing...\e[0m"

View File

@ -77,12 +77,13 @@ else
fi fi
echo "checking docker compose version..."; echo "checking docker compose version...";
if docker --help | grep compose; then if docker compose >/dev/null 2>&1; then
echo -e "\e[32mFound Compose v2!\e[0m"
COMPOSE_COMMAND="docker compose" COMPOSE_COMMAND="docker compose"
elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then
echo -e "\e[31mWARN: Your machine is using Docker-Compose v1!\e[0m" echo -e "\e[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
echo -e "\e[31mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m" echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
echo -e "\e[31mPlease consider a upgrade to Docker-Compose v2.\e[0m" echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
echo echo
echo echo
echo -e "\e[33mContinuing...\e[0m" echo -e "\e[33mContinuing...\e[0m"

View File

@ -46,12 +46,13 @@ done
echo "checking docker compose version..."; echo "checking docker compose version...";
if docker --help | grep compose; then if docker compose >/dev/null 2>&1; then
echo -e "\e[32mFound Compose v2!\e[0m"
COMPOSE_COMMAND="docker compose" COMPOSE_COMMAND="docker compose"
elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then elif docker-compose version --short | grep -m1 "^1" > /dev/null 2>&1; then
echo -e "\e[31mWARN: Your machine is using Docker-Compose v1!\e[0m" echo -e "\e[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
echo -e "\e[31mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m" echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
echo -e "\e[31mPlease consider a upgrade to Docker-Compose v2.\e[0m" echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
echo echo
echo echo
echo -e "\e[33mContinuing...\e[0m" echo -e "\e[33mContinuing...\e[0m"