Browse Source

Function to remove syncthing

Bob Mottram 8 years ago
parent
commit
62e04497ce
1 changed files with 19 additions and 0 deletions
  1. 19
    0
      src/freedombone-app-syncthing

+ 19
- 0
src/freedombone-app-syncthing View File

@@ -37,6 +37,25 @@ SYNCTHING_PORT=22000
37 37
 SYNCTHING_SHARED_DATA=/var/lib/syncthing/SyncShared
38 38
 SYNCTHING_USER_IDS_FILE='.syncthingids'
39 39
 
40
+function remove_syncthing {
41
+	if ! grep -Fxq "install_syncthing" $COMPLETION_FILE; then
42
+		return
43
+	fi
44
+	iptables -D INPUT -p udp --dport $SYNCTHING_PORT -j ACCEPT
45
+	iptables -D INPUT -p tcp --dport $SYNCTHING_PORT -j ACCEPT
46
+	function_check save_firewall_settings
47
+	save_firewall_settings
48
+
49
+	systemctl stop syncthing
50
+	systemctl disable syncthing
51
+	apt-get -y remove --purge syncthing
52
+	rm /etc/systemd/system/syncthing.service
53
+	sed -i '/freedombone-syncthing/d' /etc/crontab
54
+	sed -i '/install_syncthing/d' $COMPLETION_FILE
55
+	sed -i '/configure_firewall_for_syncthing/d' $COMPLETION_FILE
56
+	systemctl restart cron
57
+}
58
+
40 59
 function configure_firewall_for_syncthing {
41 60
 	if grep -Fxq "configure_firewall_for_syncthing" $COMPLETION_FILE; then
42 61
 		return