Browse Source

function to remove hubzilla

Bob Mottram 8 years ago
parent
commit
ebd7f2522d
1 changed files with 30 additions and 13 deletions
  1. 30
    13
      src/freedombone-app-hubzilla

+ 30
- 13
src/freedombone-app-hubzilla View File

38
 HUBZILLA_COMMIT='2d79e75788aa71664a379c4cea0b6bfe3ab87ad0'
38
 HUBZILLA_COMMIT='2d79e75788aa71664a379c4cea0b6bfe3ab87ad0'
39
 HUBZILLA_ADDONS_COMMIT='67b40c7a40f328a93ee030eb15e9e1261f3cba64'
39
 HUBZILLA_ADDONS_COMMIT='67b40c7a40f328a93ee030eb15e9e1261f3cba64'
40
 
40
 
41
+function remove_hubzilla {
42
+	if ! grep -Fxq "install_hubzilla" $COMPLETION_FILE; then
43
+		return
44
+	fi
45
+	nginx_dissite $HUBZILLA_DOMAIN_NAME
46
+	if [ -d /var/www/$HUBZILLA_DOMAIN_NAME ]; then
47
+		rm -rf /var/www/$HUBZILLA_DOMAIN_NAME
48
+	fi
49
+	if [ -f /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME ]; then
50
+		rm /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
51
+	fi
52
+	function_check drop_database
53
+	drop_database hubzilla
54
+	sed -i '/install_hubzilla/d' $COMPLETION_FILE
55
+	sed -i '/Hubzilla /d' $COMPLETION_FILE
56
+}
57
+
41
 function install_hubzilla {
58
 function install_hubzilla {
42
 	if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
59
 	if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
43
 		return
60
 		return
64
 		return
81
 		return
65
 	fi
82
 	fi
66
 
83
 
67
-    function_check install_mariadb
84
+	function_check install_mariadb
68
 	install_mariadb
85
 	install_mariadb
69
 
86
 
70
-    function_check get_mariadb_password
71
-    get_mariadb_password
87
+	function_check get_mariadb_password
88
+	get_mariadb_password
72
 
89
 
73
-    function_check repair_databases_script
74
-    repair_databases_script
90
+	function_check repair_databases_script
91
+	repair_databases_script
75
 
92
 
76
 	apt-get -y install php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt git
93
 	apt-get -y install php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt git
77
 	apt-get -y install php5-dev imagemagick php5-imagick
94
 	apt-get -y install php5-dev imagemagick php5-imagick
120
 		echo "Hubzilla onion domain:${HUBZILLA_ONION_HOSTNAME}" >> $COMPLETION_FILE
137
 		echo "Hubzilla onion domain:${HUBZILLA_ONION_HOSTNAME}" >> $COMPLETION_FILE
121
 	fi
138
 	fi
122
 
139
 
123
-    function_check get_mariadb_hubzilla_admin_password
140
+	function_check get_mariadb_hubzilla_admin_password
124
 	get_mariadb_hubzilla_admin_password
141
 	get_mariadb_hubzilla_admin_password
125
 	if [ ! $HUBZILLA_ADMIN_PASSWORD ]; then
142
 	if [ ! $HUBZILLA_ADMIN_PASSWORD ]; then
126
 		if [ -f $IMAGE_PASSWORD_FILE ]; then
143
 		if [ -f $IMAGE_PASSWORD_FILE ]; then
142
 		chmod 600 /home/$MY_USERNAME/README
159
 		chmod 600 /home/$MY_USERNAME/README
143
 	fi
160
 	fi
144
 
161
 
145
-    function_check create_database
162
+	function_check create_database
146
 	create_database hubzilla "$HUBZILLA_ADMIN_PASSWORD"
163
 	create_database hubzilla "$HUBZILLA_ADMIN_PASSWORD"
147
 
164
 
148
 	if ! grep -q "$HUBZILLA_PATH" /etc/crontab; then
165
 	if ! grep -q "$HUBZILLA_PATH" /etc/crontab; then
149
 		echo "12,22,32,42,52 * *   *   *   root cd $HUBZILLA_PATH; /usr/bin/timeout 500 /usr/bin/php include/poller.php" >> /etc/crontab
166
 		echo "12,22,32,42,52 * *   *   *   root cd $HUBZILLA_PATH; /usr/bin/timeout 500 /usr/bin/php include/poller.php" >> /etc/crontab
150
 	fi
167
 	fi
151
 
168
 
152
-    function check add_ddns_domain
169
+	function check add_ddns_domain
153
 	add_ddns_domain $HUBZILLA_DOMAIN_NAME
170
 	add_ddns_domain $HUBZILLA_DOMAIN_NAME
154
 
171
 
155
 	if [[ $ONION_ONLY == "no" ]]; then
172
 	if [[ $ONION_ONLY == "no" ]]; then
156
-	    function_check nginx_http_redirect
173
+		function_check nginx_http_redirect
157
 		nginx_http_redirect $HUBZILLA_DOMAIN_NAME
174
 		nginx_http_redirect $HUBZILLA_DOMAIN_NAME
158
 		echo 'server {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
175
 		echo 'server {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
159
 		echo '    listen 443 ssl;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
176
 		echo '    listen 443 ssl;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
301
 		echo '}' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
318
 		echo '}' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
302
 	fi
319
 	fi
303
 
320
 
304
-    function_check configure_php
321
+	function_check configure_php
305
 	configure_php
322
 	configure_php
306
 
323
 
307
-    function_check create_site_certificate
324
+	function_check create_site_certificate
308
 	create_site_certificate $HUBZILLA_DOMAIN_NAME 'yes'
325
 	create_site_certificate $HUBZILLA_DOMAIN_NAME 'yes'
309
 
326
 
310
 	if [ ! -d $HUBZILLA_PATH/view/tpl/smarty3 ]; then
327
 	if [ ! -d $HUBZILLA_PATH/view/tpl/smarty3 ]; then
329
 	function_check backup_databases_script_header
346
 	function_check backup_databases_script_header
330
 	backup_databases_script_header
347
 	backup_databases_script_header
331
 
348
 
332
-    function_check backup_database_local
349
+	function_check backup_database_local
333
 	backup_database_local hubzilla
350
 	backup_database_local hubzilla
334
 
351
 
335
 	chown -R www-data:www-data $HUBZILLA_PATH
352
 	chown -R www-data:www-data $HUBZILLA_PATH
336
 
353
 
337
-    function_check nginx_ensite
354
+	function_check nginx_ensite
338
 	nginx_ensite $HUBZILLA_DOMAIN_NAME
355
 	nginx_ensite $HUBZILLA_DOMAIN_NAME
339
 
356
 
340
 	# initialize the database
357
 	# initialize the database