Browse Source

add function heal_ip6tables_links

it's the same as iptables, the only thing that changes is the name of the functions that have a 6 after ip
Skull Writter 4 years ago
parent
commit
3706e4aaf2
1 changed files with 17 additions and 0 deletions
  1. 17 0
      func/firewall.sh

+ 17 - 0
func/firewall.sh

@@ -16,3 +16,20 @@ heal_iptables_links() {
         fi
     done
 }
+heal_ip6tables_links() {
+    packages="ip6tables ip6tables-save ip6tables-restore"
+    for package in $packages; do
+        if [ ! -e "/sbin/${package}" ]; then
+            if which ${package}; then
+                ln -s "$(which ${package})" /sbin/${package}
+            elif [ -e "/usr/sbin/${package}" ]; then
+                ln -s /usr/sbin/${package} /sbin/${package}
+            elif whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ${package}; then
+                autoiptables=$(whereis -B /bin /sbin /usr/bin /usr/sbin -f -b ${package} | cut -d '' -f 2)
+                if [ -x "$autoiptables" ]; then
+                    ln -s "$autoiptables" /sbin/${package}
+                fi
+            fi
+        fi
+    done
+}