From eff907bf906cc3a0affe9de394f8c10bb98e44ca Mon Sep 17 00:00:00 2001 From: andryyy Date: Wed, 15 Jul 2020 15:29:09 +0200 Subject: [PATCH] [Update] IMPORTANT: Remove old and unused bridges overlapping with the new bridge name. Important for older setups running updates --- update.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/update.sh b/update.sh index 5f2992a5..054eb387 100755 --- a/update.sh +++ b/update.sh @@ -417,6 +417,12 @@ if ! docker-compose config -q; then exit 1 fi +echo -e "\e[32mChecking for conflicting bridges...\e[0m" +MAILCOW_BRIDGE=$(docker-compose config | grep -i com.docker.network.bridge.name | cut -d':' -f2) +while read NAT_ID; do + iptables -t nat -D POSTROUTING $NAT_ID +done < <(iptables -L -vn -t nat --line-numbers | grep $IPV4_NETWORK | grep -E 'MASQUERADE.*all' | grep -v ${MAILCOW_BRIDGE} | cut -d' ' -f1) + DIFF_DIRECTORY=update_diffs DIFF_FILE=${DIFF_DIRECTORY}/diff_before_update_$(date +"%Y-%m-%d-%H-%M-%S") mv diff_before_update* ${DIFF_DIRECTORY}/ 2> /dev/null