From 718dcb69be97c39f33d1ccb69378f7d1894ccbbb Mon Sep 17 00:00:00 2001 From: AlexHuebi <39099705+AlexHuebi@users.noreply.github.com> Date: Sat, 2 Sep 2023 02:53:55 +0200 Subject: [PATCH 1/6] improved "FQDN" check --- update.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 8c5a4fb5..54ddcbc4 100755 --- a/update.sh +++ b/update.sh @@ -418,10 +418,23 @@ detect_docker_compose_command [[ ! -f mailcow.conf ]] && { echo "mailcow.conf is missing! Is mailcow installed?"; exit 1;} DOTS=${MAILCOW_HOSTNAME//[^.]}; -if [ ${#DOTS} -lt 2 ]; then +if [ ${#DOTS} -lt 1 ]; then echo "MAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is not a FQDN!" echo "Please change it to a FQDN and run $COMPOSE_COMMAND down followed by $COMPOSE_COMMAND up -d" exit 1 +elif [[ "${MAILCOW_HOSTNAME: -1}" == "." ]]; then + echo "MAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is ending with a dot. This is not a valid FQDN!" + exit 1 +elif [ ${#DOTS} -eq 1 ]; then + echo "MAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) does not contain a Subdomain. This is not fully tested and may cause issues." + echo "Find more information about why this message exists here: https://github.com/mailcow/mailcow-dockerized/issues/1572" + read -r -p "Do you want to proceed anyway? [y/N] " response + if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then + echo "OK. Procceding." + else + echo "OK. Exiting." + exit 1 + fi fi if grep --help 2>&1 | head -n 1 | grep -q -i "busybox"; then echo "BusyBox grep detected, please install gnu grep, \"apk add --no-cache --upgrade grep\""; exit 1; fi From e26501261e232a1edc3229173eede4862f982625 Mon Sep 17 00:00:00 2001 From: AlexHuebi <39099705+AlexHuebi@users.noreply.github.com> Date: Mon, 11 Sep 2023 20:08:42 +0200 Subject: [PATCH 2/6] "temp" change - removed "git remote set-url" --- update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/update.sh b/update.sh index 54ddcbc4..95c6478a 100755 --- a/update.sh +++ b/update.sh @@ -888,7 +888,7 @@ done [[ -f data/conf/nginx/ZZZ-ejabberd.conf ]] && rm data/conf/nginx/ZZZ-ejabberd.conf # Silently fixing remote url from andryyy to mailcow -git remote set-url origin https://github.com/mailcow/mailcow-dockerized +# git remote set-url origin https://github.com/mailcow/mailcow-dockerized echo -e "\e[32mCommitting current status...\e[0m" [[ -z "$(git config user.name)" ]] && git config user.name moo [[ -z "$(git config user.email)" ]] && git config user.email moo@cow.moo @@ -1021,4 +1021,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." \ No newline at end of file +# echo "Use \"git reset --hard hash-on-the-left\" and run $COMPOSE_COMMAND up -d afterwards." From a8930e8060104a3b943887d7a579be2838154cce Mon Sep 17 00:00:00 2001 From: AlexHuebi <39099705+AlexHuebi@users.noreply.github.com> Date: Mon, 11 Sep 2023 21:39:07 +0200 Subject: [PATCH 3/6] fixed remote url override --- update.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/update.sh b/update.sh index 95c6478a..a379ee30 100755 --- a/update.sh +++ b/update.sh @@ -887,8 +887,22 @@ done [[ -f data/conf/nginx/ZZZ-ejabberd.conf ]] && rm data/conf/nginx/ZZZ-ejabberd.conf + # Silently fixing remote url from andryyy to mailcow # git remote set-url origin https://github.com/mailcow/mailcow-dockerized + +DEFAULT_REPO=https://github.com/mailcow/mailcow-dockerized +CURRENT_REPO=$(git remote get-url origin) +if ["$CURRENT_REPO" != "$DEFAULT_REPO"] + echo "The Repository currently used is not the default Mailcow Repository." + echo "Currently Repository: $CURRENT_REPO" + echo "Default Repository: $DEFAULT_REPO" + read -r -p "Should it be changed back to default? [y/N] " repo_response + if [[ "$repo_response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then + git remote set-url origin $DEFAULT_REPO + fi +fi + echo -e "\e[32mCommitting current status...\e[0m" [[ -z "$(git config user.name)" ]] && git config user.name moo [[ -z "$(git config user.email)" ]] && git config user.email moo@cow.moo From d098e7b9e6c73e823da5dd09bbf958aee523d874 Mon Sep 17 00:00:00 2001 From: AlexHuebi <39099705+AlexHuebi@users.noreply.github.com> Date: Mon, 11 Sep 2023 21:42:43 +0200 Subject: [PATCH 4/6] fixed remote url override --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index a379ee30..6ffc06f8 100755 --- a/update.sh +++ b/update.sh @@ -893,7 +893,7 @@ done DEFAULT_REPO=https://github.com/mailcow/mailcow-dockerized CURRENT_REPO=$(git remote get-url origin) -if ["$CURRENT_REPO" != "$DEFAULT_REPO"] +if ["$CURRENT_REPO" != "$DEFAULT_REPO"]; then echo "The Repository currently used is not the default Mailcow Repository." echo "Currently Repository: $CURRENT_REPO" echo "Default Repository: $DEFAULT_REPO" From 88fbec1e5383491a2df04117516882be4d07d996 Mon Sep 17 00:00:00 2001 From: AlexHuebi <39099705+AlexHuebi@users.noreply.github.com> Date: Mon, 11 Sep 2023 21:43:52 +0200 Subject: [PATCH 5/6] fixed remote url override --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 6ffc06f8..db0db3b4 100755 --- a/update.sh +++ b/update.sh @@ -893,7 +893,7 @@ done DEFAULT_REPO=https://github.com/mailcow/mailcow-dockerized CURRENT_REPO=$(git remote get-url origin) -if ["$CURRENT_REPO" != "$DEFAULT_REPO"]; then +if [ "$CURRENT_REPO" != "$DEFAULT_REPO" ]; then echo "The Repository currently used is not the default Mailcow Repository." echo "Currently Repository: $CURRENT_REPO" echo "Default Repository: $DEFAULT_REPO" From e67ba60863d5fc4f999caab8a72ce4be3f80ffde Mon Sep 17 00:00:00 2001 From: DerLinkman Date: Thu, 5 Oct 2023 16:21:57 +0200 Subject: [PATCH 6/6] Added Colors, cause there fancy :) + Added in generate_config.sh --- generate_config.sh | 21 ++++++++++++++++++--- update.sh | 7 ++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/generate_config.sh b/generate_config.sh index d09dae9e..5c00347d 100755 --- a/generate_config.sh +++ b/generate_config.sh @@ -109,9 +109,24 @@ echo "Press enter to confirm the detected value '[value]' where applicable or en while [ -z "${MAILCOW_HOSTNAME}" ]; do read -p "Mail server hostname (FQDN) - this is not your mail domain, but your mail servers hostname: " -e MAILCOW_HOSTNAME DOTS=${MAILCOW_HOSTNAME//[^.]}; - if [ ${#DOTS} -lt 2 ] && [ ! -z ${MAILCOW_HOSTNAME} ]; then - echo "${MAILCOW_HOSTNAME} is not a FQDN" - MAILCOW_HOSTNAME= + if [ ${#DOTS} -lt 1 ]; then + echo -e "\e[31mMAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is not a FQDN!\e[0m" + sleep 1 + echo "Please change it to a FQDN and redeploy the stack with docker(-)compose up -d" + exit 1 + elif [[ "${MAILCOW_HOSTNAME: -1}" == "." ]]; then + echo "MAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is ending with a dot. This is not a valid FQDN!" + exit 1 + elif [ ${#DOTS} -eq 1 ]; then + echo -e "\e[33mMAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) does not contain a Subdomain. This is not fully tested and may cause issues.\e[0m" + echo "Find more information about why this message exists here: https://github.com/mailcow/mailcow-dockerized/issues/1572" + read -r -p "Do you want to proceed anyway? [y/N] " response + if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then + echo "OK. Procceding." + else + echo "OK. Exiting." + exit 1 + fi fi done diff --git a/update.sh b/update.sh index db0db3b4..5204659e 100755 --- a/update.sh +++ b/update.sh @@ -419,14 +419,15 @@ detect_docker_compose_command [[ ! -f mailcow.conf ]] && { echo "mailcow.conf is missing! Is mailcow installed?"; exit 1;} DOTS=${MAILCOW_HOSTNAME//[^.]}; if [ ${#DOTS} -lt 1 ]; then - echo "MAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is not a FQDN!" - echo "Please change it to a FQDN and run $COMPOSE_COMMAND down followed by $COMPOSE_COMMAND up -d" + echo -e "\e[31mMAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is not a FQDN!\e[0m" + sleep 1 + echo "Please change it to a FQDN and redeploy the stack with $COMPOSE_COMMAND up -d" exit 1 elif [[ "${MAILCOW_HOSTNAME: -1}" == "." ]]; then echo "MAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is ending with a dot. This is not a valid FQDN!" exit 1 elif [ ${#DOTS} -eq 1 ]; then - echo "MAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) does not contain a Subdomain. This is not fully tested and may cause issues." + echo -e "\e[33mMAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) does not contain a Subdomain. This is not fully tested and may cause issues.\e[0m" echo "Find more information about why this message exists here: https://github.com/mailcow/mailcow-dockerized/issues/1572" read -r -p "Do you want to proceed anyway? [y/N] " response if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then