From db7d7ea288ca1ea85959890616dd1a694452acd2 Mon Sep 17 00:00:00 2001 From: DerLinkman Date: Thu, 23 Jun 2022 10:05:09 +0200 Subject: [PATCH] Added override NGINX Port Removal --- update.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/update.sh b/update.sh index dc47c3dee..104ef38e5 100755 --- a/update.sh +++ b/update.sh @@ -209,6 +209,26 @@ migrate_docker_nat() { fi } +remove_obsolete_nginx_ports() { + # Removing obsolete docker-compose.override.yml + if [ -s docker-compose.override.* ]; then + if cat docker-compose.override.* | grep nginx-mailcow > /dev/null 2>&1; then + if cat docker-compose.override.* | grep -w [::] > /dev/null 2>&1; then + if cat docker-compose.override.* | grep -w 80:80 > /dev/null 2>&1 && cat docker-compose.override.* | grep -w 443:443 > /dev/null 2>&1 ; then + sed -i '/nginx-mailcow:$/,/^$/d' docker-compose.override.* + if [[ "$(cat docker-compose.override.yml | sed '/^\s*$/d' | wc -l)" == "2" ]]; then + mv docker-compose.override.yml docker-compose.override.yml_backup + echo -e "\e[31mRemoved obsolete NGINX IPv6 Bind from override File.\e[0m" + elif [[ "$(cat docker-compose.override.yaml | sed '/^\s*$/d' | wc -l)" == "2" ]]; then + mv docker-compose.override.yaml docker-compose.override.yaml_backup + echo -e "\e[31mRemoved obsolete NGINX IPv6 Bind from override File.\e[0m" + fi + fi + fi + fi + fi +} + update_compose(){ if [[ ${NO_UPDATE_COMPOSE} == "y" ]]; then echo -e "\e[33mNot fetching latest docker-compose, please check for updates manually!\e[0m" @@ -635,6 +655,8 @@ fi update_compose +remove_obsolete_nginx_ports + echo -e "\e[32mValidating docker-compose stack configuration...\e[0m" if ! docker-compose config -q; then echo -e "\e[31m\nOh no, something went wrong. Please check the error message above.\e[0m"