git subrepo commit mailcow/src/mailcow-dockerized
subrepo: subdir: "mailcow/src/mailcow-dockerized"
merged: "308860af"
upstream: origin: "https://github.com/mailcow/mailcow-dockerized.git"
branch: "master"
commit: "3f1a5af8"
git-subrepo: version: "0.4.5"
origin: "???"
commit: "???"
Change-Id: I5d51c14b45db54fe706be40a591ddbfcea50d4b0
diff --git a/mailcow/src/mailcow-dockerized/helper-scripts/_cold-standby.sh b/mailcow/src/mailcow-dockerized/helper-scripts/_cold-standby.sh
index c4439ea..0e8885a 100755
--- a/mailcow/src/mailcow-dockerized/helper-scripts/_cold-standby.sh
+++ b/mailcow/src/mailcow-dockerized/helper-scripts/_cold-standby.sh
@@ -77,7 +77,7 @@
exit 1
fi
- for bin in rsync docker-compose docker grep cut; do
+ for bin in rsync docker grep cut; do
if [[ -z $(which ${bin}) ]]; then
>&2 echo -e "\e[31mCannot find ${bin} in local PATH, exiting...\e[0m"
exit 1
@@ -85,7 +85,7 @@
done
if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then
- >&2 echo -e "\e[31mBusyBox grep detected on local system, please install GNU grep\e[0m"
+ echo -e "\e[31mBusyBox grep detected on local system, please install GNU grep\e[0m"
exit 1
fi
}
@@ -111,7 +111,7 @@
exit 1
fi
- for bin in rsync docker-compose docker; do
+ for bin in rsync docker; do
if ! ssh -o StrictHostKeyChecking=no \
-i "${REMOTE_SSH_KEY}" \
${REMOTE_SSH_HOST} \
@@ -122,17 +122,43 @@
fi
done
+ ssh -o StrictHostKeyChecking=no \
+ -i "${REMOTE_SSH_KEY}" \
+ ${REMOTE_SSH_HOST} \
+ -p ${REMOTE_SSH_PORT} \
+ "bash -s" << "EOF"
+if docker compose > /dev/null 2>&1; then
+ exit 0
+elif docker-compose version --short | grep "^2." > /dev/null 2>&1; then
+ exit 1
+else
+exit 2
+fi
+EOF
+
+if [ $? = 0 ]; then
+ COMPOSE_COMMAND="docker compose"
+ echo "DEBUG: Using native docker compose on remote"
+
+elif [ $? = 1 ]; then
+ COMPOSE_COMMAND="docker-compose"
+ echo "DEBUG: Using standalone docker compose on remote"
+
+else
+ echo -e "\e[31mCannot find any Docker Compose on remote, exiting...\e[0m"
+ exit 1
+fi
}
+SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "${SCRIPT_DIR}/../mailcow.conf"
+COMPOSE_FILE="${SCRIPT_DIR}/../docker-compose.yml"
+CMPS_PRJ=$(echo ${COMPOSE_PROJECT_NAME} | tr -cd 'A-Za-z-_')
+SQLIMAGE=$(grep -iEo '(mysql|mariadb)\:.+' "${COMPOSE_FILE}")
+
preflight_local_checks
preflight_remote_checks
-SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-COMPOSE_FILE="${SCRIPT_DIR}/../docker-compose.yml"
-source "${SCRIPT_DIR}/../mailcow.conf"
-CMPS_PRJ=$(echo ${COMPOSE_PROJECT_NAME} | tr -cd 'A-Za-z-_')
-SQLIMAGE=$(grep -iEo '(mysql|mariadb)\:.+' "${COMPOSE_FILE}")
-
echo
echo -e "\033[1mFound compose project name ${CMPS_PRJ} for ${MAILCOW_HOSTNAME}\033[0m"
echo -e "\033[1mFound SQL ${SQLIMAGE}\033[0m"
@@ -252,16 +278,18 @@
fi
echo "OK"
-echo -e "\033[1mPulling images on remote...\033[0m"
-if ! ssh -o StrictHostKeyChecking=no \
- -i "${REMOTE_SSH_KEY}" \
- ${REMOTE_SSH_HOST} \
- -p ${REMOTE_SSH_PORT} \
- docker-compose -f "${SCRIPT_DIR}/../docker-compose.yml" pull --no-parallel 2>&1 ; then
- >&2 echo -e "\e[31m[ERR]\e[0m - Could not pull images on remote"
-fi
+ echo -e "\e[33mPulling images on remote...\e[0m"
+ echo -e "\e[33mProcess is NOT stuck! Please wait...\e[0m"
-echo -e "\033[1mForcing garbage cleanup on remote...\033[0m"
+ if ! ssh -o StrictHostKeyChecking=no \
+ -i "${REMOTE_SSH_KEY}" \
+ ${REMOTE_SSH_HOST} \
+ -p ${REMOTE_SSH_PORT} \
+ ${COMPOSE_COMMAND} -f "${SCRIPT_DIR}/../docker-compose.yml" pull --no-parallel --quiet 2>&1 ; then
+ >&2 echo -e "\e[31m[ERR]\e[0m - Could not pull images on remote"
+ fi
+
+echo -e "\033[1mExecuting update script and forcing garbage cleanup on remote...\033[0m"
if ! ssh -o StrictHostKeyChecking=no \
-i "${REMOTE_SSH_KEY}" \
${REMOTE_SSH_HOST} \
@@ -270,4 +298,4 @@
>&2 echo -e "\e[31m[ERR]\e[0m - Could not cleanup old images on remote"
fi
-echo -e "\e[32mDone\e[0m"
+echo -e "\e[32mDone\e[0m"
\ No newline at end of file
diff --git a/mailcow/src/mailcow-dockerized/helper-scripts/add-new-lang-keys.php b/mailcow/src/mailcow-dockerized/helper-scripts/add-new-lang-keys.php
index 19010f8..1f5f377 100644
--- a/mailcow/src/mailcow-dockerized/helper-scripts/add-new-lang-keys.php
+++ b/mailcow/src/mailcow-dockerized/helper-scripts/add-new-lang-keys.php
@@ -26,7 +26,7 @@
}
// load master lang
-$masterLang = file_get_contents(__DIR__.'/../data/web/lang/lang.en.json');
+$masterLang = file_get_contents(__DIR__.'/../data/web/lang/lang.en-gb.json');
$masterLang = json_decode($masterLang, true);
// load target lang
diff --git a/mailcow/src/mailcow-dockerized/helper-scripts/backup_and_restore.sh b/mailcow/src/mailcow-dockerized/helper-scripts/backup_and_restore.sh
index 189a660..ee9f020 100755
--- a/mailcow/src/mailcow-dockerized/helper-scripts/backup_and_restore.sh
+++ b/mailcow/src/mailcow-dockerized/helper-scripts/backup_and_restore.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-DEBIAN_DOCKER_IMAGE="debian:buster-slim"
+DEBIAN_DOCKER_IMAGE="mailcow/backup:latest"
if [[ ! -z ${MAILCOW_BACKUP_LOCATION} ]]; then
BACKUP_LOCATION="${MAILCOW_BACKUP_LOCATION}"
@@ -52,6 +52,15 @@
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
COMPOSE_FILE=${SCRIPT_DIR}/../docker-compose.yml
ENV_FILE=${SCRIPT_DIR}/../.env
+THREADS=$(echo ${THREADS:-1})
+
+if ! [[ "${THREADS}" =~ ^[1-9]+$ ]] ; then
+ echo "Thread input is not a number!"
+ exit 1
+elif [[ "${THREADS}" =~ ^[1-9]+$ ]] ; then
+ echo "Using ${THREADS} Thread(s) for this run."
+ echo "Notice: You can set the Thread count with the THREADS Variable before you run this script."
+fi
if [ ! -f ${COMPOSE_FILE} ]; then
echo "Compose file not found"
@@ -76,43 +85,55 @@
CMPS_PRJ=$(echo ${COMPOSE_PROJECT_NAME} | tr -cd "[0-9A-Za-z-_]")
fi
+if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then
+ >&2 echo -e "\e[31mBusyBox grep detected on local system, please install GNU grep\e[0m"
+ exit 1
+fi
+
+
function backup() {
DATE=$(date +"%Y-%m-%d-%H-%M-%S")
mkdir -p "${BACKUP_LOCATION}/mailcow-${DATE}"
chmod 755 "${BACKUP_LOCATION}/mailcow-${DATE}"
cp "${SCRIPT_DIR}/../mailcow.conf" "${BACKUP_LOCATION}/mailcow-${DATE}"
+ for bin in docker; do
+ if [[ -z $(which ${bin}) ]]; then
+ >&2 echo -e "\e[31mCannot find ${bin} in local PATH, exiting...\e[0m"
+ exit 1
+ fi
+ done
while (( "$#" )); do
case "$1" in
vmail|all)
docker run --name mailcow-backup --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup:z \
-v $(docker volume ls -qf name=^${CMPS_PRJ}_vmail-vol-1$):/vmail:ro,z \
- ${DEBIAN_DOCKER_IMAGE} /bin/tar --warning='no-file-ignored' --use-compress-program="gzip --rsyncable" -Pcvpf /backup/backup_vmail.tar.gz /vmail
+ ${DEBIAN_DOCKER_IMAGE} /bin/tar --warning='no-file-ignored' --use-compress-program="pigz --rsyncable -p ${THREADS}" -Pcvpf /backup/backup_vmail.tar.gz /vmail
;;&
crypt|all)
docker run --name mailcow-backup --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup:z \
-v $(docker volume ls -qf name=^${CMPS_PRJ}_crypt-vol-1$):/crypt:ro,z \
- ${DEBIAN_DOCKER_IMAGE} /bin/tar --warning='no-file-ignored' --use-compress-program="gzip --rsyncable" -Pcvpf /backup/backup_crypt.tar.gz /crypt
+ ${DEBIAN_DOCKER_IMAGE} /bin/tar --warning='no-file-ignored' --use-compress-program="pigz --rsyncable -p ${THREADS}" -Pcvpf /backup/backup_crypt.tar.gz /crypt
;;&
redis|all)
docker exec $(docker ps -qf name=redis-mailcow) redis-cli save
docker run --name mailcow-backup --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup:z \
-v $(docker volume ls -qf name=^${CMPS_PRJ}_redis-vol-1$):/redis:ro,z \
- ${DEBIAN_DOCKER_IMAGE} /bin/tar --warning='no-file-ignored' --use-compress-program="gzip --rsyncable" -Pcvpf /backup/backup_redis.tar.gz /redis
+ ${DEBIAN_DOCKER_IMAGE} /bin/tar --warning='no-file-ignored' --use-compress-program="pigz --rsyncable -p ${THREADS}" -Pcvpf /backup/backup_redis.tar.gz /redis
;;&
rspamd|all)
docker run --name mailcow-backup --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup:z \
-v $(docker volume ls -qf name=^${CMPS_PRJ}_rspamd-vol-1$):/rspamd:ro,z \
- ${DEBIAN_DOCKER_IMAGE} /bin/tar --warning='no-file-ignored' --use-compress-program="gzip --rsyncable" -Pcvpf /backup/backup_rspamd.tar.gz /rspamd
+ ${DEBIAN_DOCKER_IMAGE} /bin/tar --warning='no-file-ignored' --use-compress-program="pigz --rsyncable -p ${THREADS}" -Pcvpf /backup/backup_rspamd.tar.gz /rspamd
;;&
postfix|all)
docker run --name mailcow-backup --rm \
-v ${BACKUP_LOCATION}/mailcow-${DATE}:/backup:z \
-v $(docker volume ls -qf name=^${CMPS_PRJ}_postfix-vol-1$):/postfix:ro,z \
- ${DEBIAN_DOCKER_IMAGE} /bin/tar --warning='no-file-ignored' --use-compress-program="gzip --rsyncable" -Pcvpf /backup/backup_postfix.tar.gz /postfix
+ ${DEBIAN_DOCKER_IMAGE} /bin/tar --warning='no-file-ignored' --use-compress-program="pigz --rsyncable -p ${THREADS}" -Pcvpf /backup/backup_postfix.tar.gz /postfix
;;&
mysql|all)
SQLIMAGE=$(grep -iEo '(mysql|mariadb)\:.+' ${COMPOSE_FILE})
@@ -148,6 +169,24 @@
}
function restore() {
+ for bin in docker; do
+ if [[ -z $(which ${bin}) ]]; then
+ >&2 echo -e "\e[31mCannot find ${bin} in local PATH, exiting...\e[0m"
+ exit 1
+ fi
+ done
+
+ if [ "${DOCKER_COMPOSE_VERSION}" == "native" ]; then
+ COMPOSE_COMMAND="docker compose"
+
+ elif [ "${DOCKER_COMPOSE_VERSION}" == "standalone" ]; then
+ COMPOSE_COMMAND="docker-compose"
+
+ else
+ echo -e "\e[31mCan not read DOCKER_COMPOSE_VERSION variable from mailcow.conf! Is your mailcow up to date? Exiting...\e[0m"
+ exit 1
+ fi
+
echo
echo "Stopping watchdog-mailcow..."
docker stop $(docker ps -qf name=watchdog-mailcow)
@@ -161,7 +200,7 @@
docker run -it --name mailcow-backup --rm \
-v ${RESTORE_LOCATION}:/backup:z \
-v $(docker volume ls -qf name=^${CMPS_PRJ}_vmail-vol-1$):/vmail:z \
- ${DEBIAN_DOCKER_IMAGE} /bin/tar -Pxvzf /backup/backup_vmail.tar.gz
+ ${DEBIAN_DOCKER_IMAGE} /bin/tar --use-compress-program="pigz -d -p ${THREADS}" -Pxvf /backup/backup_vmail.tar.gz
docker start $(docker ps -aqf name=dovecot-mailcow)
echo
echo "In most cases it is not required to run a full resync, you can run the command printed below at any time after testing wether the restore process broke a mailbox:"
@@ -180,7 +219,7 @@
docker run -it --name mailcow-backup --rm \
-v ${RESTORE_LOCATION}:/backup:z \
-v $(docker volume ls -qf name=^${CMPS_PRJ}_redis-vol-1$):/redis:z \
- ${DEBIAN_DOCKER_IMAGE} /bin/tar -Pxvzf /backup/backup_redis.tar.gz
+ ${DEBIAN_DOCKER_IMAGE} /bin/tar --use-compress-program="pigz -d -p ${THREADS}" -Pxvf /backup/backup_redis.tar.gz
docker start $(docker ps -aqf name=redis-mailcow)
;;
crypt)
@@ -188,7 +227,7 @@
docker run -it --name mailcow-backup --rm \
-v ${RESTORE_LOCATION}:/backup:z \
-v $(docker volume ls -qf name=^${CMPS_PRJ}_crypt-vol-1$):/crypt:z \
- ${DEBIAN_DOCKER_IMAGE} /bin/tar -Pxvzf /backup/backup_crypt.tar.gz
+ ${DEBIAN_DOCKER_IMAGE} /bin/tar --use-compress-program="pigz -d -p ${THREADS}" -Pxvf /backup/backup_crypt.tar.gz
docker start $(docker ps -aqf name=dovecot-mailcow)
;;
rspamd)
@@ -196,7 +235,7 @@
docker run -it --name mailcow-backup --rm \
-v ${RESTORE_LOCATION}:/backup:z \
-v $(docker volume ls -qf name=^${CMPS_PRJ}_rspamd-vol-1$):/rspamd:z \
- ${DEBIAN_DOCKER_IMAGE} /bin/tar -Pxvzf /backup/backup_rspamd.tar.gz
+ ${DEBIAN_DOCKER_IMAGE} /bin/tar --use-compress-program="pigz -d -p ${THREADS}" -Pxvf /backup/backup_rspamd.tar.gz
docker start $(docker ps -aqf name=rspamd-mailcow)
;;
postfix)
@@ -204,7 +243,7 @@
docker run -it --name mailcow-backup --rm \
-v ${RESTORE_LOCATION}:/backup:z \
-v $(docker volume ls -qf name=^${CMPS_PRJ}_postfix-vol-1$):/postfix:z \
- ${DEBIAN_DOCKER_IMAGE} /bin/tar -Pxvzf /backup/backup_postfix.tar.gz
+ ${DEBIAN_DOCKER_IMAGE} /bin/tar --use-compress-program="pigz -d -p ${THREADS}" -Pxvf /backup/backup_postfix.tar.gz
docker start $(docker ps -aqf name=postfix-mailcow)
;;
mysql|mariadb)
@@ -226,7 +265,7 @@
continue
else
echo "Stopping mailcow..."
- docker-compose -f ${COMPOSE_FILE} --env-file ${ENV_FILE} down
+ ${COMPOSE_COMMAND} -f ${COMPOSE_FILE} --env-file ${ENV_FILE} down
fi
#docker stop $(docker ps -qf name=mysql-mailcow)
if [[ -d "${RESTORE_LOCATION}/mysql" ]]; then
@@ -264,7 +303,7 @@
sed -i --follow-symlinks "/DBROOT/c\DBROOT=${DBROOT}" ${SCRIPT_DIR}/../mailcow.conf
source ${SCRIPT_DIR}/../mailcow.conf
echo "Starting mailcow..."
- docker-compose -f ${COMPOSE_FILE} --env-file ${ENV_FILE} up -d
+ ${COMPOSE_COMMAND} -f ${COMPOSE_FILE} --env-file ${ENV_FILE} up -d
#docker start $(docker ps -aqf name=mysql-mailcow)
fi
;;
diff --git a/mailcow/src/mailcow-dockerized/helper-scripts/check_translations.rb b/mailcow/src/mailcow-dockerized/helper-scripts/check_translations.rb
index af4da1c..a8bfb5a 100755
--- a/mailcow/src/mailcow-dockerized/helper-scripts/check_translations.rb
+++ b/mailcow/src/mailcow-dockerized/helper-scripts/check_translations.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
-MASTER="en"
+MASTER="en-gb"
DIR = "#{__dir__}/.."
diff --git a/mailcow/src/mailcow-dockerized/helper-scripts/docker-compose.override.yml.d/HAPROXY/docker-compose.override.yml b/mailcow/src/mailcow-dockerized/helper-scripts/docker-compose.override.yml.d/HAPROXY/docker-compose.override.yml
index 21d391b..5009f4c 100644
--- a/mailcow/src/mailcow-dockerized/helper-scripts/docker-compose.override.yml.d/HAPROXY/docker-compose.override.yml
+++ b/mailcow/src/mailcow-dockerized/helper-scripts/docker-compose.override.yml.d/HAPROXY/docker-compose.override.yml
@@ -1,6 +1,6 @@
##
## Set haproxy_trusted_networks in Dovecots extra.conf!
-#ä
+##
version: '2.1'
services:
diff --git a/mailcow/src/mailcow-dockerized/helper-scripts/nextcloud.sh b/mailcow/src/mailcow-dockerized/helper-scripts/nextcloud.sh
index 94bc997..16311fc 100755
--- a/mailcow/src/mailcow-dockerized/helper-scripts/nextcloud.sh
+++ b/mailcow/src/mailcow-dockerized/helper-scripts/nextcloud.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+NEXTCLOUD_VER="25"
for bin in curl dirmngr; do
if [[ -z $(which ${bin}) ]]; then echo "Cannot find ${bin}, exiting..."; exit 1; fi
@@ -40,7 +41,7 @@
fi
docker exec -it $(docker ps -f name=mysql-mailcow -q) mysql -uroot -p${DBROOT} -e \
- "$(docker exec -it $(docker ps -f name=mysql-mailcow -q) mysql -uroot -p${DBROOT} -e "SELECT IFNULL(GROUP_CONCAT('DROP TABLE ', TABLE_SCHEMA, '.', TABLE_NAME SEPARATOR ';'),'SELECT NULL;') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'nc_%' AND TABLE_SCHEMA = '${DBNAME}';" -BN)"
+ "$(docker exec -it $(docker ps -f name=mysql-mailcow -q) mysql -uroot -p${DBROOT} -e "SELECT IFNULL(GROUP_CONCAT('DROP TABLE ', TABLE_SCHEMA, '.', TABLE_NAME SEPARATOR ';'),'SELECT NULL;') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'oc_%' AND TABLE_SCHEMA = '${DBNAME}';" -BN)"
docker exec -it $(docker ps -f name=redis-mailcow -q) /bin/sh -c ' cat <<EOF | redis-cli
SELECT 10
FLUSHDB
@@ -76,7 +77,7 @@
echo "Cannot upgrade to new major version, please update manually."
exit 1
else
- curl -L# -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-22.tar.bz2" || { echo "Failed to download Nextcloud archive."; exit 1; } \
+ curl -L# -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-$NEXTCLOUD_VER.tar.bz2" || { echo "Failed to download Nextcloud archive."; exit 1; } \
&& tar -xjf nextcloud.tar.bz2 -C ./data/web/ \
&& rm nextcloud.tar.bz2 \
&& mkdir -p ./data/web/nextcloud/data \
@@ -97,7 +98,7 @@
ADMIN_NC_PASS=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28)
- curl -L# -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-22.tar.bz2" || { echo "Failed to download Nextcloud archive."; exit 1; } \
+ curl -L# -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-$NEXTCLOUD_VER.tar.bz2" || { echo "Failed to download Nextcloud archive."; exit 1; } \
&& tar -xjf nextcloud.tar.bz2 -C ./data/web/ \
&& rm nextcloud.tar.bz2 \
&& mkdir -p ./data/web/nextcloud/data \
diff --git a/mailcow/src/mailcow-dockerized/helper-scripts/update_compose.sh b/mailcow/src/mailcow-dockerized/helper-scripts/update_compose.sh
new file mode 100755
index 0000000..ae2d6ab
--- /dev/null
+++ b/mailcow/src/mailcow-dockerized/helper-scripts/update_compose.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+source ${SCRIPT_DIR}/../mailcow.conf
+
+if [ "${DOCKER_COMPOSE_VERSION}" == "standalone" ]; then
+LATEST_COMPOSE=$(curl -Ls -w %{url_effective} -o /dev/null https://github.com/docker/compose/releases/latest) # redirect to latest release
+LATEST_COMPOSE=${LATEST_COMPOSE##*/v} #get the latest version from the redirect, excluding the "v" prefix
+COMPOSE_VERSION=$(docker-compose version --short)
+if [[ "$LATEST_COMPOSE" != "$COMPOSE_VERSION" ]]; then
+ echo -e "\e[33mA new docker-compose Version is available: $LATEST_COMPOSE\e[0m"
+ echo -e "\e[33mYour Version is: $COMPOSE_VERSION\e[0m"
+else
+ echo -e "\e[32mYour docker-compose Version is up to date! Not updating it...\e[0m"
+ exit 0
+fi
+read -r -p "Do you want to update your docker-compose Version? It will automatic upgrade your docker-compose installation (recommended)? [y/N] " updatecomposeresponse
+ if [[ ! "${updatecomposeresponse}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
+ echo "OK, not updating docker-compose."
+ exit 0
+ fi
+echo -e "\e[32mFetching new docker-compose (standalone) version...\e[0m"
+echo -e "\e[32mTrying to determine GLIBC version...\e[0m"
+ if ldd --version > /dev/null; then
+ GLIBC_V=$(ldd --version | grep -E '(GLIBC|GNU libc)' | rev | cut -d ' ' -f1 | rev | cut -d '.' -f2)
+ if [ ! -z "${GLIBC_V}" ] && [ ${GLIBC_V} -gt 27 ]; then
+ DC_DL_SUFFIX=
+ else
+ DC_DL_SUFFIX=legacy
+ fi
+ else
+ DC_DL_SUFFIX=legacy
+ fi
+ sleep 1
+ 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
+ echo -e "\e[33mExiting...\e[0m"
+ exit 1
+ #prevent breaking a working docker-compose installed with pip
+ elif [[ $(curl -sL -w "%{http_code}" https://github.com/docker/compose/releases/latest -o /dev/null) == "200" ]]; then
+ LATEST_COMPOSE=$(curl -Ls -w %{url_effective} -o /dev/null https://github.com/docker/compose/releases/latest) # redirect to latest release
+ LATEST_COMPOSE=${LATEST_COMPOSE##*/} #get the latest version from the redirect, inlcuding the "v" prefix
+ COMPOSE_VERSION=$(docker-compose version --short)
+ if [[ "$LATEST_COMPOSE" != "$COMPOSE_VERSION" ]]; then
+ COMPOSE_PATH=$(command -v docker-compose)
+ if [[ -w ${COMPOSE_PATH} ]]; then
+ curl -#L https://github.com/docker/compose/releases/download/${LATEST_COMPOSE}/docker-compose-$(uname -s)-$(uname -m) > $COMPOSE_PATH
+ chmod +x $COMPOSE_PATH
+ echo -e "\e[32mYour Docker Compose (standalone) has been updated to: $LATEST_COMPOSE\e[0m"
+ exit 0
+ else
+ echo -e "\e[33mWARNING: $COMPOSE_PATH is not writable, but new version $LATEST_COMPOSE is available (installed: $COMPOSE_VERSION)\e[0m"
+ exit 1
+ fi
+ fi
+ else
+ echo -e "\e[33mCannot determine latest docker-compose version, skipping...\e[0m"
+ exit 1
+ fi
+
+elif [ "${DOCKER_COMPOSE_VERSION}" == "native" ]; then
+ echo -e "\e[31mYou are using the native Docker Compose Plugin. This Script is for the standalone Docker Compose Version only.\e[0m"
+ sleep 2
+ echo -e "\e[33mNotice: You'll have to update this Compose Version via your Package Manager manually!\e[0m"
+ exit 1
+
+else
+ echo -e "\e[31mCan not read DOCKER_COMPOSE_VERSION variable from mailcow.conf! Is your mailcow up to date? Exiting...\e[0m"
+ exit 1
+fi
\ No newline at end of file