Browse Source

Function to remove webmail

Bob Mottram 8 years ago
parent
commit
df9468a1a4
1 changed files with 21 additions and 3 deletions
  1. 21
    3
      src/freedombone-app-webmail

+ 21
- 3
src/freedombone-app-webmail View File

@@ -33,15 +33,33 @@ WEBMAIL_COMMIT='78cf9c2e5cff2d78cd8beb647d60570f195a2a9c'
33 33
 WEBMAIL_ONION_HOSTNAME=
34 34
 WEBMAIL_ONION_PORT=8097
35 35
 WEBMAIL_ADMIN_PASSWORD=
36
+WEB_PATH=/var/www
37
+WEBMAIL_PATH=$WEB_PATH/webmail
38
+
39
+function remove_webmail {
40
+	if ! grep -Fxq "install_webmail" $COMPLETION_FILE; then
41
+		return
42
+	fi
43
+	nginx_dissite webmail
44
+	if [ -f /etc/nginx/sites-available/webmail ]; then
45
+		rm /etc/nginx/sites-available/webmail
46
+	fi
47
+	function_check remove_onion_service
48
+	remove_onion_service webmail ${WEBMAIL_ONION_PORT}
49
+	function_check drop_database
50
+	drop_database webmain
51
+	if [ -d $WEB_PATH/webmail ]; then
52
+		rm -rf $WEB_PATH/webmail
53
+	fi
54
+	sed -i '/Webmail /d' $COMPLETION_FILE
55
+	sed -i '/install_webmail/d' $COMPLETION_FILE
56
+}
36 57
 
37 58
 function install_webmail {
38 59
 	if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
39 60
 		return
40 61
 	fi
41 62
 
42
-	WEB_PATH=/var/www
43
-	WEBMAIL_PATH=$WEB_PATH/webmail
44
-
45 63
 	# update to a new commit if needed
46 64
 	function_check set_repo_commit
47 65
 	set_repo_commit $WEBMAIL_PATH "Webmail commit" "$WEBMAIL_COMMIT" $WEBMAIL_REPO