function to remove cjdns

This commit is contained in:
Bob Mottram 2016-07-03 20:25:46 +01:00
parent 84b383b29c
commit c892dedab4
1 changed files with 381 additions and 367 deletions

View File

@ -49,6 +49,9 @@ function configure_firewall_for_cjdns {
fi
ip6tables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
ip6tables -A FORWARD -i tun0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
ip6tables -A INPUT -p udp --dport $CJDNS_PORT -j ACCEPT
ip6tables -A INPUT -p tcp --dport $CJDNS_PORT -j ACCEPT
function_check save_firewall_settings
save_firewall_settings
echo 'configure_firewall_for_cjdns' >> $COMPLETION_FILE
@ -104,6 +107,23 @@ function get_cjdns_password {
fi
}
function remove_cjdns {
if ! grep -Fxq "mesh_cjdns" $COMPLETION_FILE; then
return
fi
service cjdns stop
ip6tables -t nat -D POSTROUTING -o tun0 -j MASQUERADE
ip6tables -D FORWARD -i tun0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
ip6tables -D INPUT -p udp --dport $CJDNS_PORT -j ACCEPT
ip6tables -D INPUT -p tcp --dport $CJDNS_PORT -j ACCEPT
function_check save_firewall_settings
save_firewall_settings
rm -rf /etc/cjdns
sed -i '/mesh_cjdns/d' $COMPLETION_FILE
sed -i '/configure_firewall_for_cjdns/d' $COMPLETION_FILE
}
function mesh_cjdns {
if [[ $ENABLE_CJDNS != "yes" ]]; then
return
@ -348,12 +368,6 @@ function mesh_cjdns {
fi
fi
ip6tables -A INPUT -p udp --dport $CJDNS_PORT -j ACCEPT
ip6tables -A INPUT -p tcp --dport $CJDNS_PORT -j ACCEPT
function_ckeck save_firewall_settings
save_firewall_settings
if ! grep -q $"Mesh Networking (cjdns)" /home/$MY_USERNAME/README; then
CURRENT_IP_ADDRESS=$(ip addr show | grep "inet " | sed -n 2p | awk -F ' ' '{print $2}' | awk -F '/' '{print $1}')