@@ -13,7 +13,7 @@ source "lib.sh"
1313pids=$( ps -o ppid=$$ )
1414ps -aux | grep -P " ^[^-]+$this_dir /start.sh" | awk ' {print $2}' | while read -r pid; do grep -q " $pid " <<< " $pids" || sudo kill -9 " $pid " & > /dev/null; done
1515
16- if [ " ${CLS_WG_ONLY:- false} " = " false " ]; then
16+ if [ ! " ${CLS_WG_ONLY:- false} " = " true " ]; then
1717 [ -d config ] || sudo mkdir config
1818 [[ -f config/wifis.json && -s config/wifis.json ]] || echo " {}" | sudo tee config/wifis.json
1919
@@ -79,13 +79,12 @@ if [ "$CLS_DOCKER" = "true" ]; then
7979 sudo ip6tables -L -t " $table " | grep -q " $chain " || sudo ip6tables -N " $chain " -t " $table "
8080 done
8181 done
82- else
83- sudo sysctl -w net.ipv4.ip_forward=0
84- sudo sysctl -w net.ipv6.conf.all.forwarding=0
85- for iface in $( wg | grep -oP ' (?<=interface: ).+' ) ; do sudo wg-quick down " $iface " ; done
86- wg | grep -oP ' (?<=^interface: ).+' | while read -r iface; do sudo wg-quick down " $iface " & > /dev/null; done
8782fi
8883
84+ sudo sysctl -w net.ipv4.ip_forward=0
85+ sudo sysctl -w net.ipv6.conf.all.forwarding=0
86+ for iface in $( wg | grep -oP ' (?<=interface: ).+' ) ; do sudo wg-quick down " $iface " ; done
87+ wg | grep -oP ' (?<=^interface: ).+' | while read -r iface; do sudo wg-quick down " $iface " & > /dev/null; done
8988eval " cast pre-up ${*@ Q} "
9089
9190(
@@ -138,8 +137,9 @@ eval "cast pre-up ${*@Q}"
138137
139138if [ " $CLS_DOCKER " = " true" ]; then
140139 # prod starts wg
141- if [ " ${CLS_WG_ONLY:- false} " = " false " ] || ! sudo docker ps | grep -qE " pihole.*Up" ; then
140+ if [ ! " ${CLS_WG_ONLY:- false} " = " true " ] || ! sudo docker ps | grep -qE " pihole.*Up" ; then
142141 sudo docker compose down
142+ sudo docker compose ps -aq | xargs -r sudo docker rm -f
143143 sudo systemctl restart docker
144144 sudo docker network prune -f
145145 until [ -n " $CLS_LOCAL_IP " ]; do
@@ -165,9 +165,10 @@ else
165165 sudo wg-quick down " $iface "
166166 sudo wg-quick up " $iface "
167167 done
168- restart_isc
169168fi
170169
170+ restart_isc
171+
171172if [[ " $CLS_TYPE_NODE " == " haas" && -n " $CLS_SAAH_PEER " ]]; then
172173 [[ -d " wireguard/config/peer_$CLS_SAAH_PEER " ]] || exec sudo bash wireguard/add.sh " $CLS_SAAH_PEER " -- ${@@ Q}
173174 saah_ip=" $( grep -oP ' (?<=Address = ).+' " wireguard/config/peer_$CLS_SAAH_PEER /peer_$CLS_SAAH_PEER .conf" 2> /dev/null) "
0 commit comments