git subrepo commit (merge) mailcow/src/mailcow-dockerized
subrepo: subdir: "mailcow/src/mailcow-dockerized"
merged: "2866fb80"
upstream: origin: "https://github.com/mailcow/mailcow-dockerized.git"
branch: "master"
commit: "e29e35d0"
git-subrepo: version: "0.4.6"
origin: "???"
commit: "???"
Change-Id: I26ce31f84c1ff9e905669570f9fc7eb754ce6c1c
diff --git a/mailcow/src/mailcow-dockerized/update.sh b/mailcow/src/mailcow-dockerized/update.sh
index d80e2b7..5204659 100755
--- a/mailcow/src/mailcow-dockerized/update.sh
+++ b/mailcow/src/mailcow-dockerized/update.sh
@@ -339,119 +339,6 @@
DATE=$(date +%Y-%m-%d_%H_%M_%S)
BRANCH=$(cd ${SCRIPT_DIR}; git rev-parse --abbrev-ref HEAD)
- if [[ "$(cat $override | sed '/^\s*$/d' | wc -l)" == "2" ]]; then
- mv $override ${override}_empty
- echo -e "\e[31m${override} is empty. Renamed it to ensure mailcow is startable.\e[0m"
- fi
- fi
- fi
- fi
- fi
- done
-}
-
-detect_docker_compose_command(){
-if ! [ "${DOCKER_COMPOSE_VERSION}" == "native" ] && ! [ "${DOCKER_COMPOSE_VERSION}" == "standalone" ]; then
- if docker compose > /dev/null 2>&1; then
- if docker compose version --short | grep "2." > /dev/null 2>&1; then
- DOCKER_COMPOSE_VERSION=native
- COMPOSE_COMMAND="docker compose"
- echo -e "\e[31mFound Docker Compose Plugin (native).\e[0m"
- echo -e "\e[31mSetting the DOCKER_COMPOSE_VERSION Variable to native\e[0m"
- sleep 2
- echo -e "\e[33mNotice: You'll have to update this Compose Version via your Package Manager manually!\e[0m"
- else
- echo -e "\e[31mCannot find Docker Compose with a Version Higher than 2.X.X.\e[0m"
- echo -e "\e[31mPlease update/install it manually regarding to this doc site: https://mailcow.github.io/mailcow-dockerized-docs/i_u_m/i_u_m_install/\e[0m"
- exit 1
- fi
- elif docker-compose > /dev/null 2>&1; then
- if ! [[ $(alias docker-compose 2> /dev/null) ]] ; then
- if docker-compose version --short | grep "^2." > /dev/null 2>&1; then
- DOCKER_COMPOSE_VERSION=standalone
- COMPOSE_COMMAND="docker-compose"
- echo -e "\e[31mFound Docker Compose Standalone.\e[0m"
- echo -e "\e[31mSetting the DOCKER_COMPOSE_VERSION Variable to standalone\e[0m"
- sleep 2
- echo -e "\e[33mNotice: For an automatic update of docker-compose please use the update_compose.sh scripts located at the helper-scripts folder.\e[0m"
- else
- echo -e "\e[31mCannot find Docker Compose with a Version Higher than 2.X.X.\e[0m"
- echo -e "\e[31mPlease update/install regarding to this doc site: https://mailcow.github.io/mailcow-dockerized-docs/i_u_m/i_u_m_install/\e[0m"
- exit 1
- fi
- fi
-
- else
- echo -e "\e[31mCannot find Docker Compose.\e[0m"
- echo -e "\e[31mPlease install it regarding to this doc site: https://mailcow.github.io/mailcow-dockerized-docs/i_u_m/i_u_m_install/\e[0m"
- exit 1
- fi
-
-elif [ "${DOCKER_COMPOSE_VERSION}" == "native" ]; then
- COMPOSE_COMMAND="docker compose"
-
-elif [ "${DOCKER_COMPOSE_VERSION}" == "standalone" ]; then
- COMPOSE_COMMAND="docker-compose"
-fi
-}
-
-############## End Function Section ##############
-
-# Check permissions
-if [ "$(id -u)" -ne "0" ]; then
- echo "You need to be root"
- exit 1
-fi
-
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-# Run pre-update-hook
-if [ -f "${SCRIPT_DIR}/pre_update_hook.sh" ]; then
- bash "${SCRIPT_DIR}/pre_update_hook.sh"
-fi
-
-if [[ "$(uname -r)" =~ ^4\.15\.0-60 ]]; then
- echo "DO NOT RUN mailcow ON THIS UBUNTU KERNEL!";
- echo "Please update to 5.x or use another distribution."
- exit 1
-fi
-
-if [[ "$(uname -r)" =~ ^4\.4\. ]]; then
- if grep -q Ubuntu <<< $(uname -a); then
- echo "DO NOT RUN mailcow ON THIS UBUNTU KERNEL!"
- echo "Please update to linux-generic-hwe-16.04 by running \"apt-get install --install-recommends linux-generic-hwe-16.04\""
- exit 1
- fi
- echo "mailcow on a 4.4.x kernel is not supported. It may or may not work, please upgrade your kernel or continue at your own risk."
- read -p "Press any key to continue..." < /dev/tty
-fi
-
-# Exit on error and pipefail
-set -o pipefail
-
-# Setting high dc timeout
-export COMPOSE_HTTP_TIMEOUT=600
-
-# Add /opt/bin to PATH
-PATH=$PATH:/opt/bin
-
-umask 0022
-
-# Unset COMPOSE_COMMAND and DOCKER_COMPOSE_VERSION Variable to be on the newest state.
-unset COMPOSE_COMMAND
-unset DOCKER_COMPOSE_VERSION
-
-for bin in curl docker git awk sha1sum; do
- if [[ -z $(command -v ${bin}) ]]; then
- echo "Cannot find ${bin}, exiting..."
- exit 1;
- fi
-done
-
-export LC_ALL=C
-DATE=$(date +%Y-%m-%d_%H_%M_%S)
-BRANCH=$(cd ${SCRIPT_DIR}; git rev-parse --abbrev-ref HEAD)
-
while (($#)); do
case "${1}" in
--check|-c)
@@ -504,6 +391,7 @@
-d|--dev)
echo -e "\e[32mRunning in Developer mode...\e[0m"
DEV=y
+ ;;
--help|-h)
echo './update.sh [-c|--check, --ours, --gc, --nightly, --prefetch, --skip-start, --skip-ping-check, --stable, -f|--force, -d|--dev, -h|--help]
@@ -937,70 +825,6 @@
git checkout -f ${BRANCH}
fi
- else
- echo -e "\e[33mYou are receiving updates from a unsupported branch.\e[0m"
- sleep 1
- echo -e "\e[33mThe mailcow stack might still work but it is recommended to switch to the master branch (stable builds).\e[0m"
- echo -e "\e[33mTo change that run the update.sh Script one time with the --stable parameter to switch to stable builds.\e[0m"
- fi
-elif [ $FORCE ]; then
- echo -e "\e[31mYou are running in forced mode!\e[0m"
- echo -e "\e[31mA Branch Switch can only be performed manually (monitored).\e[0m"
- echo -e "\e[31mPlease rerun the update.sh Script without the --force/-f parameter.\e[0m"
- sleep 1
-elif [ $NEW_BRANCH == "master" ] && [ $CURRENT_BRANCH != "master" ]; then
- echo -e "\e[33mYou are about to switch your mailcow Updates to the stable (master) branch.\e[0m"
- sleep 1
- echo -e "\e[33mBefore you do: Please take a backup of all components to ensure that no Data is lost...\e[0m"
- sleep 1
- echo -e "\e[31mWARNING: Please see on GitHub or ask in the communitys if a switch to master is stable or not.
- In some rear cases a Update back to master can destroy your mailcow configuration in case of Database Upgrades etc.
- Normally a upgrade back to master should be safe during each full release.
- Check GitHub for Database Changes and Update only if there similar to the full release!\e[0m"
- read -r -p "Are you sure you that want to continue upgrading to the stable (master) branch? [y/N] " response
- if [[ ! "${response}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
- echo "OK. If you prepared yourself for that please run the update.sh Script with the --stable parameter again to trigger this process here."
- exit 0
- fi
- BRANCH=$NEW_BRANCH
- DIFF_DIRECTORY=update_diffs
- DIFF_FILE=${DIFF_DIRECTORY}/diff_before_upgrade_to_master_$(date +"%Y-%m-%d-%H-%M-%S")
- mv diff_before_upgrade* ${DIFF_DIRECTORY}/ 2> /dev/null
- if ! git diff-index --quiet HEAD; then
- echo -e "\e[32mSaving diff to ${DIFF_FILE}...\e[0m"
- mkdir -p ${DIFF_DIRECTORY}
- git diff ${BRANCH} --stat > ${DIFF_FILE}
- git diff ${BRANCH} >> ${DIFF_FILE}
- fi
- echo -e "\e[32mSwitching Branch to ${BRANCH}...\e[0m"
- git fetch origin
- git checkout -f ${BRANCH}
-
-elif [ $NEW_BRANCH == "nightly" ] && [ $CURRENT_BRANCH != "nightly" ]; then
- echo -e "\e[33mYou are about to switch your mailcow Updates to the unstable (nightly) branch.\e[0m"
- sleep 1
- echo -e "\e[33mBefore you do: Please take a backup of all components to ensure that no Data is lost...\e[0m"
- sleep 1
- echo -e "\e[31mWARNING: A switch to nightly is possible any time. But a switch back (to master) isn't.\e[0m"
- read -r -p "Are you sure you that want to continue upgrading to the unstable (nightly) branch? [y/N] " response
- if [[ ! "${response}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
- echo "OK. If you prepared yourself for that please run the update.sh Script with the --nightly parameter again to trigger this process here."
- exit 0
- fi
- BRANCH=$NEW_BRANCH
- DIFF_DIRECTORY=update_diffs
- DIFF_FILE=${DIFF_DIRECTORY}/diff_before_upgrade_to_nightly_$(date +"%Y-%m-%d-%H-%M-%S")
- mv diff_before_upgrade* ${DIFF_DIRECTORY}/ 2> /dev/null
- if ! git diff-index --quiet HEAD; then
- echo -e "\e[32mSaving diff to ${DIFF_FILE}...\e[0m"
- mkdir -p ${DIFF_DIRECTORY}
- git diff ${BRANCH} --stat > ${DIFF_FILE}
- git diff ${BRANCH} >> ${DIFF_FILE}
- fi
- git fetch origin
- git checkout -f ${BRANCH}
-fi
-
if [ ! $DEV ]; then
echo -e "\e[32mChecking for newer update script...\e[0m"
SHA1_1=$(sha1sum update.sh)
@@ -1012,6 +836,8 @@
chmod +x update.sh
exit 2
fi
+fi
+
if [ ! $FORCE ]; then
read -r -p "Are you sure you want to update mailcow: dockerized? All containers will be stopped. [y/N] " response
if [[ ! "${response}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
@@ -1190,9 +1016,6 @@
echo -e "\e[33mCannot determine current git repository version...\e[0m"
fi
-# Set DOCKER_COMPOSE_VERSION
-sed -i 's/^DOCKER_COMPOSE_VERSION=$/DOCKER_COMPOSE_VERSION='$DOCKER_COMPOSE_VERSION'/g' mailcow.conf
-
if [[ ${SKIP_START} == "y" ]]; then
echo -e "\e[33mNot starting mailcow, please run \"$COMPOSE_COMMAND up -d --remove-orphans\" to start mailcow.\e[0m"
else
@@ -1213,4 +1036,4 @@
# 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."
\ No newline at end of file
+# echo "Use \"git reset --hard hash-on-the-left\" and run $COMPOSE_COMMAND up -d afterwards."