Procházet zdrojové kódy

function to remove blog

Bob Mottram před 8 roky
rodič
revize
84b383b29c
1 změnil soubory, kde provedl 26 přidání a 5 odebrání
  1. 26
    5
      src/freedombone-app-blog

+ 26
- 5
src/freedombone-app-blog Zobrazit soubor

@@ -36,6 +36,27 @@ FULLBLOG_COMMIT='bf5fe9486160be4da86d8987d3e5c977e1dc6d32'
36 36
 MY_BLOG_TITLE="My Blog"
37 37
 MY_BLOG_SUBTITLE="Another ${PROJECT_NAME} Blog"
38 38
 
39
+function remove_blog {
40
+	if ! grep -Fxq "install_blog" $COMPLETION_FILE; then
41
+		return
42
+	fi
43
+	if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME ]; then
44
+		rm -rf /var/www/$FULLBLOG_DOMAIN_NAME
45
+	fi
46
+	nginx_dissite $FULLBLOG_DOMAIN_NAME
47
+	if [ ! -f /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME ]; then
48
+		rm -rf /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
49
+	fi
50
+	if [ $FULLBLOG_CODE ]; then
51
+		if [ -f /usr/bin/dynamicdns ]; then
52
+			sed -i "/$FULLBLOG_DOMAIN_NAME/d" /usr/bin/dynamicdns
53
+			sed -i "/$FULLBLOG_CODE/d" /usr/bin/dynamicdns
54
+		fi
55
+	fi
56
+	sed -i '/install_blog/d' $COMPLETION_FILE
57
+	sed -i '/Blog .*/d' $COMPLETION_FILE
58
+}
59
+
39 60
 function mark_blog_domain {
40 61
 	if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
41 62
 		return
@@ -91,7 +112,7 @@ function install_blog {
91 112
 	chown -R www-data:www-data /var/www/$FULLBLOG_DOMAIN_NAME/htdocs
92 113
 
93 114
 	if [[ $ONION_ONLY == "no" ]]; then
94
-	    function_check nginx_http_redirect
115
+		function_check nginx_http_redirect
95 116
 		nginx_http_redirect $FULLBLOG_DOMAIN_NAME
96 117
 		echo 'server {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
97 118
 		echo '    listen 443 ssl;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
@@ -254,10 +275,10 @@ function install_blog {
254 275
 	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
255 276
 	echo '}' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
256 277
 
257
-    function_check create_site_certificate
278
+	function_check create_site_certificate
258 279
 	create_site_certificate $FULLBLOG_DOMAIN_NAME 'yes'
259 280
 
260
-    function_check configure_php
281
+	function_check configure_php
261 282
 	configure_php
262 283
 
263 284
 	# blog settings
@@ -317,7 +338,7 @@ function install_blog {
317 338
 	echo ';Role' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
318 339
 	echo 'role = admin' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
319 340
 
320
-    function_check nginx_ensite
341
+	function_check nginx_ensite
321 342
 	nginx_ensite $FULLBLOG_DOMAIN_NAME
322 343
 
323 344
 	FULLBLOG_ONION_HOSTNAME=$(add_onion_service blog 80 ${FULLBLOG_ONION_PORT})
@@ -334,7 +355,7 @@ function install_blog {
334 355
 	fi
335 356
 	echo "Blog onion domain:${FULLBLOG_ONION_HOSTNAME}" >> $COMPLETION_FILE
336 357
 
337
-    function_check add_ddns_domain
358
+	function_check add_ddns_domain
338 359
 	add_ddns_domain $FULLBLOG_DOMAIN_NAME
339 360
 
340 361
 	echo 'install_blog' >> $COMPLETION_FILE