From 62e04497ceb94fa5f8bcbb8c039978e8320b8583 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 4 Jul 2016 13:19:05 +0100 Subject: [PATCH] Function to remove syncthing --- src/freedombone-app-syncthing | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/freedombone-app-syncthing b/src/freedombone-app-syncthing index 2fb19b29..dac89ce2 100755 --- a/src/freedombone-app-syncthing +++ b/src/freedombone-app-syncthing @@ -37,6 +37,25 @@ SYNCTHING_PORT=22000 SYNCTHING_SHARED_DATA=/var/lib/syncthing/SyncShared 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 { if grep -Fxq "configure_firewall_for_syncthing" $COMPLETION_FILE; then return