From 787fa49d0c060da5d330d1f104ff7bae666754b0 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Tue, 25 Feb 2025 12:08:21 +0100 Subject: [PATCH 1/2] prompt user before applying major updates --- update.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/update.sh b/update.sh index c11179c5..94ffaf69 100755 --- a/update.sh +++ b/update.sh @@ -710,6 +710,43 @@ migrate_solr_config_options() { fi } +detect_major_update() { + if [ ${BRANCH} == "master" ]; then + # Array with major versions + # Add major versions here + MAJOR_VERSIONS=( + ) + + current_version=$(git describe --tags $(git rev-list --tags --max-count=1)) + release_url="https://github.com/mailcow/mailcow-dockerized/releases/tag" + + updates_to_apply=() + + for version in "${MAJOR_VERSIONS[@]}"; do + if [[ "$current_version" < "$version" ]]; then + updates_to_apply+=("$version") + fi + done + + if [[ ${#updates_to_apply[@]} -gt 0 ]]; then + echo -e "\e[33m\nMAJOR UPDATES to be applied:\e[0m" + for update in "${updates_to_apply[@]}"; do + echo "$update - $release_url/$update" + done + + echo -e "\n⚠️ Please read the release notes before proceeding.\n" + + read -p "Do you want to proceed with the update? [y/n] " response + if [[ "${response}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then + echo "Proceeding with the update..." + else + echo "Update canceled. Exiting." + exit 1 + fi + fi + fi +} + ############## End Function Section ############## # Check permissions @@ -1345,6 +1382,7 @@ if [ ! "$FORCE" ]; then echo "OK, exiting." exit 0 fi + detect_major_update migrate_docker_nat fi From 3d9cc2f6dd5aa950977ee9fb59e13ad212c3f57e Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Thu, 27 Feb 2025 08:14:34 +0100 Subject: [PATCH 2/2] add 2025-02 to major versions --- update.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/update.sh b/update.sh index 94ffaf69..9cfb02fd 100755 --- a/update.sh +++ b/update.sh @@ -715,6 +715,7 @@ detect_major_update() { # Array with major versions # Add major versions here MAJOR_VERSIONS=( + "2025-02" ) current_version=$(git describe --tags $(git rev-list --tags --max-count=1))