Browse Source

Function to remove wiki

Bob Mottram 8 years ago
parent
commit
eadc7fc342
1 changed files with 30 additions and 4 deletions
  1. 30
    4
      src/freedombone-app-wiki

+ 30
- 4
src/freedombone-app-wiki View File

34
 WIKI_CODE=
34
 WIKI_CODE=
35
 WIKI_ONION_PORT=8089
35
 WIKI_ONION_PORT=8089
36
 
36
 
37
+function remove_wiki {
38
+	if ! grep -Fxq "install_wiki" $COMPLETION_FILE; then
39
+		return
40
+	fi
41
+	function_check remove_onion_service
42
+	remove_onion_service wiki ${WIKI_ONION_PORT}
43
+	nginx_dissite $WIKI_DOMAIN_NAME
44
+	if [ -f /etc/nginx/sites-available/$WIKI_DOMAIN_NAME ]; then
45
+		rm /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
46
+	fi
47
+	apt-get -y remove --purge dokuwiki
48
+	if [ ! -d /var/www/$WIKI_DOMAIN_NAME ]; then
49
+		rm -rf /var/www/$WIKI_DOMAIN_NAME
50
+	fi
51
+	if [ -d /var/lib/dokuwiki ]; then
52
+		rm -rf /var/lib/dokuwiki
53
+	fi
54
+	if [ -d /etc/dokuwiki ]; then
55
+		rm -rf /etc/dokuwiki
56
+	fi
57
+	if [ -d /usr/share/dokuwiki ]; then
58
+		rm -rf /usr/share/dokuwiki
59
+	fi
60
+	sed -i '/install_wiki/d' $COMPLETION_FILE
61
+}
62
+
37
 function get_wiki_admin_password {
63
 function get_wiki_admin_password {
38
 	if [ -f /home/$MY_USERNAME/README ]; then
64
 	if [ -f /home/$MY_USERNAME/README ]; then
39
 		if grep -q "Wiki password" /home/$MY_USERNAME/README; then
65
 		if grep -q "Wiki password" /home/$MY_USERNAME/README; then
102
 		echo "\$conf['authtype'] = 'authplain';" >> /etc/dokuwiki/local.php
128
 		echo "\$conf['authtype'] = 'authplain';" >> /etc/dokuwiki/local.php
103
 	fi
129
 	fi
104
 
130
 
105
-    function_check get_wiki_admin_password
131
+	function_check get_wiki_admin_password
106
 	get_wiki_admin_password
132
 	get_wiki_admin_password
107
 	if [ ! $WIKI_ADMIN_PASSWORD ]; then
133
 	if [ ! $WIKI_ADMIN_PASSWORD ]; then
108
 		if [ -f $IMAGE_PASSWORD_FILE ]; then
134
 		if [ -f $IMAGE_PASSWORD_FILE ]; then
372
 	echo '    }' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
398
 	echo '    }' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
373
 	echo '}' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
399
 	echo '}' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
374
 
400
 
375
-    function_check create_site_certificate
401
+	function_check create_site_certificate
376
 	create_site_certificate $WIKI_DOMAIN_NAME
402
 	create_site_certificate $WIKI_DOMAIN_NAME
377
 
403
 
378
-    function_check configure_php
404
+	function_check configure_php
379
 	configure_php
405
 	configure_php
380
 
406
 
381
 	nginx_ensite $WIKI_DOMAIN_NAME
407
 	nginx_ensite $WIKI_DOMAIN_NAME
385
 
411
 
386
 	echo "Wiki onion domain:${WIKI_ONION_HOSTNAME}" >> $COMPLETION_FILE
412
 	echo "Wiki onion domain:${WIKI_ONION_HOSTNAME}" >> $COMPLETION_FILE
387
 
413
 
388
-    function_check add_ddns_domain
414
+	function_check add_ddns_domain
389
 	add_ddns_domain $WIKI_DOMAIN_NAME
415
 	add_ddns_domain $WIKI_DOMAIN_NAME
390
 
416
 
391
 	# add some post-install instructions
417
 	# add some post-install instructions