Function to remove wiki

This commit is contained in:
Bob Mottram 2016-07-04 19:23:17 +01:00
parent df9468a1a4
commit eadc7fc342
1 changed files with 30 additions and 4 deletions

View File

@ -34,6 +34,32 @@ WIKI_TITLE="${PROJECT_NAME} Wiki"
WIKI_CODE=
WIKI_ONION_PORT=8089
function remove_wiki {
if ! grep -Fxq "install_wiki" $COMPLETION_FILE; then
return
fi
function_check remove_onion_service
remove_onion_service wiki ${WIKI_ONION_PORT}
nginx_dissite $WIKI_DOMAIN_NAME
if [ -f /etc/nginx/sites-available/$WIKI_DOMAIN_NAME ]; then
rm /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
fi
apt-get -y remove --purge dokuwiki
if [ ! -d /var/www/$WIKI_DOMAIN_NAME ]; then
rm -rf /var/www/$WIKI_DOMAIN_NAME
fi
if [ -d /var/lib/dokuwiki ]; then
rm -rf /var/lib/dokuwiki
fi
if [ -d /etc/dokuwiki ]; then
rm -rf /etc/dokuwiki
fi
if [ -d /usr/share/dokuwiki ]; then
rm -rf /usr/share/dokuwiki
fi
sed -i '/install_wiki/d' $COMPLETION_FILE
}
function get_wiki_admin_password {
if [ -f /home/$MY_USERNAME/README ]; then
if grep -q "Wiki password" /home/$MY_USERNAME/README; then
@ -102,7 +128,7 @@ function install_wiki {
echo "\$conf['authtype'] = 'authplain';" >> /etc/dokuwiki/local.php
fi
function_check get_wiki_admin_password
function_check get_wiki_admin_password
get_wiki_admin_password
if [ ! $WIKI_ADMIN_PASSWORD ]; then
if [ -f $IMAGE_PASSWORD_FILE ]; then
@ -372,10 +398,10 @@ function install_wiki {
echo ' }' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
echo '}' >> /etc/nginx/sites-available/$WIKI_DOMAIN_NAME
function_check create_site_certificate
function_check create_site_certificate
create_site_certificate $WIKI_DOMAIN_NAME
function_check configure_php
function_check configure_php
configure_php
nginx_ensite $WIKI_DOMAIN_NAME
@ -385,7 +411,7 @@ function install_wiki {
echo "Wiki onion domain:${WIKI_ONION_HOSTNAME}" >> $COMPLETION_FILE
function_check add_ddns_domain
function_check add_ddns_domain
add_ddns_domain $WIKI_DOMAIN_NAME
# add some post-install instructions