Browse Source

More removal functions for zeronet

Bob Mottram 8 years ago
parent
commit
e93015723b
1 changed files with 53 additions and 9 deletions
  1. 53
    9
      src/freedombone-app-zeronet

+ 53
- 9
src/freedombone-app-zeronet View File

@@ -45,6 +45,59 @@ ZERONET_DEFAULT_MAIL_TAGLINE="Mail for the Mesh"
45 45
 ZERONET_ID_REPO="https://github.com/HelloZeroNet/ZeroID"
46 46
 ZERONET_ID_COMMIT='ccf14fdc96fa9cdb2ddd8a7ab283a8e17a4f234b'
47 47
 
48
+function remove_zeronet_blog {
49
+	if ! grep -Fxq "install_zeronet_blog" $COMPLETION_FILE; then
50
+		return
51
+	fi
52
+	if [ -d $MESH_INSTALL_DIR/zeronet/ZeroBlog ]; then
53
+		rm -rf $MESH_INSTALL_DIR/zeronet/ZeroBlog
54
+	fi
55
+	sed -i '/install_zeronet_blog/d' $COMPLETION_FILE
56
+	sed -i '/ZeroNet Blog/d' $COMPLETION_FILE
57
+}
58
+
59
+function remove_zeronet_mail {
60
+	if ! grep -Fxq "install_zeronet_mail" $COMPLETION_FILE; then
61
+		return
62
+	fi
63
+	if [ -d $MESH_INSTALL_DIR/zeronet/ZeroMail ]; then
64
+		rm -rf $MESH_INSTALL_DIR/zeronet/ZeroMail
65
+	fi
66
+	sed -i '/install_zeronet_mail/d' $COMPLETION_FILE
67
+	sed -i '/ZeroNet Mail/d' $COMPLETION_FILE
68
+}
69
+
70
+function remove_zeronet_forum {
71
+	if ! grep -Fxq "install_zeronet_forum" $COMPLETION_FILE; then
72
+		return
73
+	fi
74
+	if [ -d $MESH_INSTALL_DIR/zeronet/ZeroTalk ]; then
75
+		rm -rf $MESH_INSTALL_DIR/zeronet/ZeroTalk
76
+	fi
77
+	sed -i '/install_zeronet_forum/d' $COMPLETION_FILE
78
+	sed -i '/ZeroNet Forum/d' $COMPLETION_FILE
79
+}
80
+
81
+function remove_zeronet {
82
+	remove_zeronet_blog
83
+	remove_zeronet_mail
84
+	remove_zeronet_forum
85
+	if ! grep -Fxq "install_zeronet" $COMPLETION_FILE; then
86
+		return
87
+	fi
88
+	iptables -D INPUT -i $WIFI_INTERFACE -p udp --dport $ZERONET_PORT -j ACCEPT
89
+	iptables -D INPUT -i $WIFI_INTERFACE -p tcp --dport $ZERONET_PORT -j ACCEPT
90
+	iptables -D INPUT -i $WIFI_INTERFACE -p udp --dport $TRACKER_PORT -j ACCEPT
91
+	iptables -D INPUT -i $WIFI_INTERFACE -p tcp --dport $TRACKER_PORT -j ACCEPT
92
+	iptables -D INPUT -i $WIFI_INTERFACE -p udp --dport 1900 -j ACCEPT
93
+	function_check save_firewall_settings
94
+	save_firewall_settings
95
+	${PROJECT_NAME}-mesh-install -f zeronet --remove yes
96
+	sed -i '/install_zeronet/d' $COMPLETION_FILE
97
+	sed -i '/ZeroNet /d' $COMPLETION_FILE
98
+	sed -i '/configure_firewall_for_zeronet/d' $COMPLETION_FILE
99
+}
100
+
48 101
 function configure_firewall_for_zeronet {
49 102
 	if grep -Fxq "configure_firewall_for_zeronet" $COMPLETION_FILE; then
50 103
 		return
@@ -378,15 +431,6 @@ function install_zeronet_forum {
378 431
 	echo 'install_zeronet_forum' >> $COMPLETION_FILE
379 432
 }
380 433
 
381
-function remove_zeronet {
382
-	if ! grep -Fxq "install_zeronet" $COMPLETION_FILE; then
383
-		return
384
-	fi
385
-	${PROJECT_NAME}-mesh-install -f zeronet --remove yes
386
-	sed -i '/install_zeronet/d' $COMPLETION_FILE
387
-	sed -i '/ZeroNet /d' $COMPLETION_FILE
388
-}
389
-
390 434
 function install_zeronet {
391 435
 	if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
392 436
 		return