mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2024-12-09 08:50:05 +08:00
Optimized if-else arguments and outputs
This commit is contained in:
parent
958112af6b
commit
74baf20feb
@ -30,12 +30,12 @@ for bin in openssl curl docker git awk sha1sum; do
|
||||
done
|
||||
|
||||
echo "checking docker compose version...";
|
||||
if docker --help | grep compose; then
|
||||
echo ''
|
||||
if docker compose >/dev/null 2>&1; then
|
||||
echo -e "\e[32mFound Compose v2!\e[0m"
|
||||
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[31mmailcow 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[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
|
||||
echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
|
||||
echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
|
||||
echo
|
||||
echo
|
||||
echo -e "\e[33mContinuing...\e[0m"
|
||||
|
@ -86,12 +86,12 @@ function preflight_local_checks() {
|
||||
|
||||
|
||||
echo "checking docker compose version...";
|
||||
if docker --help | grep compose; then
|
||||
echo ''
|
||||
if docker compose >/dev/null 2>&1; then
|
||||
echo -e "\e[32mFound Compose v2 on local machine!\e[0m"
|
||||
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[31mmailcow 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[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
|
||||
echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
|
||||
echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
|
||||
echo
|
||||
echo
|
||||
echo -e "\e[33mContinuing...\e[0m"
|
||||
@ -144,16 +144,17 @@ function preflight_remote_checks() {
|
||||
-i "${REMOTE_SSH_KEY}" \
|
||||
${REMOTE_SSH_HOST} \
|
||||
-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"
|
||||
elif ssh -q -o StrictHostKeyChecking=no \
|
||||
-i "${REMOTE_SSH_KEY}" \
|
||||
${REMOTE_SSH_HOST} \
|
||||
-p ${REMOTE_SSH_PORT} \
|
||||
'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[31mmailcow 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"
|
||||
-t 'docker-compose version --short' | grep -m1 "^1" > /dev/null 2>&1; then
|
||||
echo -e "\e[33mWARN: The remote is using Docker-Compose v1!\e[0m"
|
||||
echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
|
||||
echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2 on remote.\e[0m"
|
||||
echo
|
||||
echo
|
||||
echo -e "\e[33mContinuing...\e[0m"
|
||||
|
@ -77,12 +77,13 @@ else
|
||||
fi
|
||||
|
||||
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"
|
||||
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[31mmailcow 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[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
|
||||
echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
|
||||
echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
|
||||
echo
|
||||
echo
|
||||
echo -e "\e[33mContinuing...\e[0m"
|
||||
|
11
update.sh
11
update.sh
@ -46,12 +46,13 @@ done
|
||||
|
||||
|
||||
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"
|
||||
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[31mmailcow 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[33mWARN: Your machine is using Docker-Compose v1!\e[0m"
|
||||
echo -e "\e[33mmailcow will drop the Docker-Compose v1 Support in December 2022\e[0m"
|
||||
echo -e "\e[33mPlease consider a upgrade to Docker-Compose v2.\e[0m"
|
||||
echo
|
||||
echo
|
||||
echo -e "\e[33mContinuing...\e[0m"
|
||||
@ -738,4 +739,4 @@ fi
|
||||
#echo
|
||||
#git reflog --color=always | grep "Before update on "
|
||||
#echo
|
||||
#echo "Use \"git reset --hard hash-on-the-left\" and run ${COMPOSE_COMMAND} up -d afterwards."
|
||||
#echo "Use \"git reset --hard hash-on-the-left\" and run ${COMPOSE_COMMAND} up -d afterwards."
|
Loading…
Reference in New Issue
Block a user