Function to remove syncthing

This commit is contained in:
Bob Mottram 2016-07-04 13:19:05 +01:00
parent 089b8e204b
commit 62e04497ce
1 changed files with 19 additions and 0 deletions

View File

@ -37,6 +37,25 @@ SYNCTHING_PORT=22000
SYNCTHING_SHARED_DATA=/var/lib/syncthing/SyncShared SYNCTHING_SHARED_DATA=/var/lib/syncthing/SyncShared
SYNCTHING_USER_IDS_FILE='.syncthingids' SYNCTHING_USER_IDS_FILE='.syncthingids'
function remove_syncthing {
if ! grep -Fxq "install_syncthing" $COMPLETION_FILE; then
return
fi
iptables -D INPUT -p udp --dport $SYNCTHING_PORT -j ACCEPT
iptables -D INPUT -p tcp --dport $SYNCTHING_PORT -j ACCEPT
function_check save_firewall_settings
save_firewall_settings
systemctl stop syncthing
systemctl disable syncthing
apt-get -y remove --purge syncthing
rm /etc/systemd/system/syncthing.service
sed -i '/freedombone-syncthing/d' /etc/crontab
sed -i '/install_syncthing/d' $COMPLETION_FILE
sed -i '/configure_firewall_for_syncthing/d' $COMPLETION_FILE
systemctl restart cron
}
function configure_firewall_for_syncthing { function configure_firewall_for_syncthing {
if grep -Fxq "configure_firewall_for_syncthing" $COMPLETION_FILE; then if grep -Fxq "configure_firewall_for_syncthing" $COMPLETION_FILE; then
return return