function to remove blog

This commit is contained in:
Bob Mottram 2016-07-03 20:19:58 +01:00
parent 64a64641d1
commit 84b383b29c
1 changed files with 26 additions and 5 deletions

View File

@ -36,6 +36,27 @@ FULLBLOG_COMMIT='bf5fe9486160be4da86d8987d3e5c977e1dc6d32'
MY_BLOG_TITLE="My Blog"
MY_BLOG_SUBTITLE="Another ${PROJECT_NAME} Blog"
function remove_blog {
if ! grep -Fxq "install_blog" $COMPLETION_FILE; then
return
fi
if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME ]; then
rm -rf /var/www/$FULLBLOG_DOMAIN_NAME
fi
nginx_dissite $FULLBLOG_DOMAIN_NAME
if [ ! -f /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME ]; then
rm -rf /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
fi
if [ $FULLBLOG_CODE ]; then
if [ -f /usr/bin/dynamicdns ]; then
sed -i "/$FULLBLOG_DOMAIN_NAME/d" /usr/bin/dynamicdns
sed -i "/$FULLBLOG_CODE/d" /usr/bin/dynamicdns
fi
fi
sed -i '/install_blog/d' $COMPLETION_FILE
sed -i '/Blog .*/d' $COMPLETION_FILE
}
function mark_blog_domain {
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
return
@ -91,7 +112,7 @@ function install_blog {
chown -R www-data:www-data /var/www/$FULLBLOG_DOMAIN_NAME/htdocs
if [[ $ONION_ONLY == "no" ]]; then
function_check nginx_http_redirect
function_check nginx_http_redirect
nginx_http_redirect $FULLBLOG_DOMAIN_NAME
echo 'server {' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
echo ' listen 443 ssl;' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
@ -254,10 +275,10 @@ function install_blog {
echo ' }' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
echo '}' >> /etc/nginx/sites-available/$FULLBLOG_DOMAIN_NAME
function_check create_site_certificate
function_check create_site_certificate
create_site_certificate $FULLBLOG_DOMAIN_NAME 'yes'
function_check configure_php
function_check configure_php
configure_php
# blog settings
@ -317,7 +338,7 @@ function install_blog {
echo ';Role' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
echo 'role = admin' >> /var/www/$FULLBLOG_DOMAIN_NAME/htdocs/config/users/$MY_USERNAME.ini
function_check nginx_ensite
function_check nginx_ensite
nginx_ensite $FULLBLOG_DOMAIN_NAME
FULLBLOG_ONION_HOSTNAME=$(add_onion_service blog 80 ${FULLBLOG_ONION_PORT})
@ -334,7 +355,7 @@ function install_blog {
fi
echo "Blog onion domain:${FULLBLOG_ONION_HOSTNAME}" >> $COMPLETION_FILE
function_check add_ddns_domain
function_check add_ddns_domain
add_ddns_domain $FULLBLOG_DOMAIN_NAME
echo 'install_blog' >> $COMPLETION_FILE