浏览代码

function to remove blog

Bob Mottram 8 年前
父节点
当前提交
84b383b29c
共有 1 个文件被更改,包括 26 次插入5 次删除
  1. 26
    5
      src/freedombone-app-blog

+ 26
- 5
src/freedombone-app-blog 查看文件

36
 MY_BLOG_TITLE="My Blog"
36
 MY_BLOG_TITLE="My Blog"
37
 MY_BLOG_SUBTITLE="Another ${PROJECT_NAME} Blog"
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
 function mark_blog_domain {
60
 function mark_blog_domain {
40
 	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
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
 		return
62
 		return
91
 	chown -R www-data:www-data /var/www/$FULLBLOG_DOMAIN_NAME/htdocs
112
 	chown -R www-data:www-data /var/www/$FULLBLOG_DOMAIN_NAME/htdocs
92
 
113
 
93
 	if [[ $ONION_ONLY == "no" ]]; then
114
 	if [[ $ONION_ONLY == "no" ]]; then
94
-	    function_check nginx_http_redirect
115
+		function_check nginx_http_redirect
95
 		nginx_http_redirect $FULLBLOG_DOMAIN_NAME
116
 		nginx_http_redirect $FULLBLOG_DOMAIN_NAME
96
 		echo 'server {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
117
 		echo 'server {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
97
 		echo '    listen 443 ssl;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
118
 		echo '    listen 443 ssl;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
254
 	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
275
 	echo '    }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
255
 	echo '}' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
276
 	echo '}' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
256
 
277
 
257
-    function_check create_site_certificate
278
+	function_check create_site_certificate
258
 	create_site_certificate $FULLBLOG_DOMAIN_NAME 'yes'
279
 	create_site_certificate $FULLBLOG_DOMAIN_NAME 'yes'
259
 
280
 
260
-    function_check configure_php
281
+	function_check configure_php
261
 	configure_php
282
 	configure_php
262
 
283
 
263
 	# blog settings
284
 	# blog settings
317
 	echo ';Role' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
338
 	echo ';Role' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
318
 	echo 'role = admin' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
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
 	nginx_ensite $FULLBLOG_DOMAIN_NAME
342
 	nginx_ensite $FULLBLOG_DOMAIN_NAME
322
 
343
 
323
 	FULLBLOG_ONION_HOSTNAME=$(add_onion_service blog 80 ${FULLBLOG_ONION_PORT})
344
 	FULLBLOG_ONION_HOSTNAME=$(add_onion_service blog 80 ${FULLBLOG_ONION_PORT})
334
 	fi
355
 	fi
335
 	echo "Blog onion domain:${FULLBLOG_ONION_HOSTNAME}" >> $COMPLETION_FILE
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
 	add_ddns_domain $FULLBLOG_DOMAIN_NAME
359
 	add_ddns_domain $FULLBLOG_DOMAIN_NAME
339
 
360
 
340
 	echo 'install_blog' >> $COMPLETION_FILE
361
 	echo 'install_blog' >> $COMPLETION_FILE