Browse Source

Fix #1689 (#1724)

* Fix #1689

* Improve code
Jaap Marcus 5 years ago
parent
commit
aead06a000
1 changed files with 8 additions and 1 deletions
  1. 8 1
      bin/v-stop-firewall

+ 8 - 1
bin/v-stop-firewall

@@ -79,10 +79,17 @@ else
     if dpkg-query -W -f'${Status}' "netplan*" 2>/dev/null | grep -q "ok installed"; then
         preup="/usr/lib/networkd-dispatcher/routable.d/50-ifup-hooks"
         if [ ! -e "$preup" ]; then
+            for iface in $(ip token | awk -F 'dev ' '{print $2}'); do 
+                if [ -z "$interfaces" ]; then
+                    interfaces=" \"\$IFACE\"==\"$iface\""
+                else
+                    interfaces="$interfaces || \"\$IFACE\"==\"$iface\" ";
+                fi
+            done
             IFS='%'
             echo '#!/bin/bash' > $preup
             echo '' >> $preup
-            echo 'if [ "$IFACE" == "'$(/bin/ip token | awk -F 'dev ' '{print $2}')'" ]; then' >> $preup
+            echo 'if [['$interfaces']]; then' >> $preup
             echo '    sleep 3' >> $preup
             echo '    /sbin/iptables-restore < /etc/iptables.rules' >> $preup
             echo 'fi' >> $preup