From b77ff2f51ce3491beb5aee30434619ddc79aba73 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Wed, 26 Feb 2025 09:47:59 +0100 Subject: [PATCH 1/4] Add switch to legacy version --- data/web/templates/base.twig | 8 ++++++++ generate_config.sh | 8 ++++++++ update.sh | 37 ++++++++++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/data/web/templates/base.twig b/data/web/templates/base.twig index 4d0a30251..87bdddab5 100644 --- a/data/web/templates/base.twig +++ b/data/web/templates/base.twig @@ -569,6 +569,14 @@ function recursiveBase64StrToArrayBuffer(obj) { Build: {{ mailcow_info.git_commit_date }} {% endif %} + {% if mailcow_cc_username and mailcow_info.mailcow_branch|lower == "legacy" and mailcow_info.version_tag|default %} + + 🛠️🐮 + 🐋 = 💕 + Legacy: {{ mailcow_info.version_tag }} +
+ Build: {{ mailcow_info.git_commit_date }} +
+ {% endif %} diff --git a/generate_config.sh b/generate_config.sh index 052764a6b..e9a82ff5a 100755 --- a/generate_config.sh +++ b/generate_config.sh @@ -181,11 +181,15 @@ if [[ ${SKIP_BRANCH} != y ]]; then echo "Available Branches:" echo "- master branch (stable updates) | default, recommended [1]" echo "- nightly branch (unstable updates, testing) | not-production ready [2]" + echo "- legacy branch (supported until February 2026) | deprecated, security updates only [3]" sleep 1 while [ -z "${MAILCOW_BRANCH}" ]; do read -r -p "Choose the Branch with it's number [1/2] " branch case $branch in + [3]) + MAILCOW_BRANCH="legacy" + ;; [2]) MAILCOW_BRANCH="nightly" ;; @@ -534,6 +538,10 @@ case ${git_branch} in mailcow_git_version=$(git rev-parse --short $(git rev-parse @{upstream})) mailcow_last_git_version="" ;; + legacy) + mailcow_git_version=$(git rev-parse --short $(git rev-parse @{upstream})) + mailcow_last_git_version="" + ;; *) mailcow_git_version=$(git rev-parse --short HEAD) mailcow_last_git_version="" diff --git a/update.sh b/update.sh index c11179c5e..985d2cd1c 100755 --- a/update.sh +++ b/update.sh @@ -845,8 +845,12 @@ while (($#)); do echo -e "\e[32mRunning in Developer mode...\e[0m" DEV=y ;; + --legacy) + CURRENT_BRANCH="$(cd "${SCRIPT_DIR}"; git rev-parse --abbrev-ref HEAD)" + NEW_BRANCH="legacy" + ;; --help|-h) - echo './update.sh [-c|--check, --check-tags, --ours, --gc, --nightly, --prefetch, --skip-start, --skip-ping-check, --stable, -f|--force, -d|--dev, -h|--help] + echo './update.sh [-c|--check, --check-tags, --ours, --gc, --nightly, --prefetch, --skip-start, --skip-ping-check, --stable, --legacy, -f|--force, -d|--dev, -h|--help] -c|--check - Check for updates and exit (exit codes => 0: update available, 3: no updates) --check-tags - Check for newer tags and exit (exit codes => 0: newer tag available, 3: no newer tag) @@ -856,7 +860,8 @@ while (($#)); do --prefetch - Only prefetch new images and exit (useful to prepare updates) --skip-start - Do not start mailcow after update --skip-ping-check - Skip ICMP Check to public DNS resolvers (Use it only if you'\''ve blocked any ICMP Connections to your mailcow machine) - --stable - Switch your mailcow updates to the stable (master) branch. Default unless you changed it with --nightly. + --stable - Switch your mailcow updates to the stable (master) branch. Default unless you changed it with --nightly or --legacy. + --legacy - Switch your mailcow updates to the legacy branch. The legacy branch will only recieve security updates until February 2026. -f|--force - Force update, do not ask questions -d|--dev - Enables Developer Mode (No Checkout of update.sh for tests) ' @@ -1262,6 +1267,11 @@ if ! [ "$NEW_BRANCH" ]; then sleep 1 echo -e "\e[33mTo change that run the update.sh Script one time with the --stable parameter to switch to stable builds.\e[0m" + elif [ "${BRANCH}" == "legcy" ]; then + echo -e "\e[31mYou are receiving legacy updates. The legacy branch will only recieve security updates until February 2026.\e[0m" + sleep 1 + echo -e "\e[33mTo change that run the update.sh Script one time with the --stable parameter to switch to stable builds.\e[0m" + else echo -e "\e[33mYou are receiving updates from an unsupported branch.\e[0m" sleep 1 @@ -1324,6 +1334,29 @@ elif [ "$NEW_BRANCH" == "nightly" ] && [ "$CURRENT_BRANCH" != "nightly" ]; then fi git fetch origin git checkout -f "${BRANCH}" +elif [ "$NEW_BRANCH" == "legacy" ] && [ "$CURRENT_BRANCH" != "legacy" ]; then + echo -e "\e[33mYou are about to switch your mailcow Updates to the legacy 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 stable or nightly is possible any time.\e[0m" + read -r -p "Are you sure you that want to continue upgrading to the legacy 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 --legacy 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_legacy_$(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 From 8d0c03b2fcaea088e1ece18faccde9a2d404a13d Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Wed, 26 Feb 2025 10:39:41 +0100 Subject: [PATCH 2/4] small adjustment for legacy version --- data/web/templates/base.twig | 2 +- generate_config.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/web/templates/base.twig b/data/web/templates/base.twig index 87bdddab5..eb8d3711a 100644 --- a/data/web/templates/base.twig +++ b/data/web/templates/base.twig @@ -571,7 +571,7 @@ function recursiveBase64StrToArrayBuffer(obj) { {% endif %} {% if mailcow_cc_username and mailcow_info.mailcow_branch|lower == "legacy" and mailcow_info.version_tag|default %} - 🛠️🐮 + 🐋 = 💕 + ⚰️🐮 + 🐋 = 💕 Legacy: {{ mailcow_info.version_tag }}
Build: {{ mailcow_info.git_commit_date }} diff --git a/generate_config.sh b/generate_config.sh index e9a82ff5a..c7a7cb64f 100755 --- a/generate_config.sh +++ b/generate_config.sh @@ -185,7 +185,7 @@ if [[ ${SKIP_BRANCH} != y ]]; then sleep 1 while [ -z "${MAILCOW_BRANCH}" ]; do - read -r -p "Choose the Branch with it's number [1/2] " branch + read -r -p "Choose the Branch with it's number [1/2/3] " branch case $branch in [3]) MAILCOW_BRANCH="legacy" From 70ba3615837f4039941f51ad4b150255c480f5ad Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Thu, 20 Mar 2025 14:15:15 +0100 Subject: [PATCH 3/4] update.sh: Fix text in legacy update prompt --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 985d2cd1c..3a43dc288 100755 --- a/update.sh +++ b/update.sh @@ -1340,7 +1340,7 @@ elif [ "$NEW_BRANCH" == "legacy" ] && [ "$CURRENT_BRANCH" != "legacy" ]; then 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 stable or nightly is possible any time.\e[0m" - read -r -p "Are you sure you that want to continue upgrading to the legacy branch? [y/N] " response + read -r -p "Are you sure you want to continue upgrading to the legacy 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 --legacy parameter again to trigger this process here." exit 0 From 684256b66ea073b6efc22edeb754fee87d55e7a8 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Thu, 20 Mar 2025 14:23:28 +0100 Subject: [PATCH 4/4] update.sh: Fix legacy typo --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 3a43dc288..cac1450c1 100755 --- a/update.sh +++ b/update.sh @@ -1267,7 +1267,7 @@ if ! [ "$NEW_BRANCH" ]; then sleep 1 echo -e "\e[33mTo change that run the update.sh Script one time with the --stable parameter to switch to stable builds.\e[0m" - elif [ "${BRANCH}" == "legcy" ]; then + elif [ "${BRANCH}" == "legacy" ]; then echo -e "\e[31mYou are receiving legacy updates. The legacy branch will only recieve security updates until February 2026.\e[0m" sleep 1 echo -e "\e[33mTo change that run the update.sh Script one time with the --stable parameter to switch to stable builds.\e[0m"