function to remove hubzilla

This commit is contained in:
Bob Mottram 2016-07-03 21:40:03 +01:00
parent 7612453887
commit ebd7f2522d
1 changed files with 30 additions and 13 deletions

View File

@ -38,6 +38,23 @@ HUBZILLA_ADMIN_PASSWORD=
HUBZILLA_COMMIT='2d79e75788aa71664a379c4cea0b6bfe3ab87ad0' HUBZILLA_COMMIT='2d79e75788aa71664a379c4cea0b6bfe3ab87ad0'
HUBZILLA_ADDONS_COMMIT='67b40c7a40f328a93ee030eb15e9e1261f3cba64' HUBZILLA_ADDONS_COMMIT='67b40c7a40f328a93ee030eb15e9e1261f3cba64'
function remove_hubzilla {
if ! grep -Fxq "install_hubzilla" $COMPLETION_FILE; then
return
fi
nginx_dissite $HUBZILLA_DOMAIN_NAME
if [ -d /var/www/$HUBZILLA_DOMAIN_NAME ]; then
rm -rf /var/www/$HUBZILLA_DOMAIN_NAME
fi
if [ -f /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME ]; then
rm /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
fi
function_check drop_database
drop_database hubzilla
sed -i '/install_hubzilla/d' $COMPLETION_FILE
sed -i '/Hubzilla /d' $COMPLETION_FILE
}
function install_hubzilla { function install_hubzilla {
if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CHAT" || $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
return return
@ -64,14 +81,14 @@ function install_hubzilla {
return return
fi fi
function_check install_mariadb function_check install_mariadb
install_mariadb install_mariadb
function_check get_mariadb_password function_check get_mariadb_password
get_mariadb_password get_mariadb_password
function_check repair_databases_script function_check repair_databases_script
repair_databases_script repair_databases_script
apt-get -y install php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt git apt-get -y install php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt git
apt-get -y install php5-dev imagemagick php5-imagick apt-get -y install php5-dev imagemagick php5-imagick
@ -120,7 +137,7 @@ function install_hubzilla {
echo "Hubzilla onion domain:${HUBZILLA_ONION_HOSTNAME}" >> $COMPLETION_FILE echo "Hubzilla onion domain:${HUBZILLA_ONION_HOSTNAME}" >> $COMPLETION_FILE
fi fi
function_check get_mariadb_hubzilla_admin_password function_check get_mariadb_hubzilla_admin_password
get_mariadb_hubzilla_admin_password get_mariadb_hubzilla_admin_password
if [ ! $HUBZILLA_ADMIN_PASSWORD ]; then if [ ! $HUBZILLA_ADMIN_PASSWORD ]; then
if [ -f $IMAGE_PASSWORD_FILE ]; then if [ -f $IMAGE_PASSWORD_FILE ]; then
@ -142,18 +159,18 @@ function install_hubzilla {
chmod 600 /home/$MY_USERNAME/README chmod 600 /home/$MY_USERNAME/README
fi fi
function_check create_database function_check create_database
create_database hubzilla "$HUBZILLA_ADMIN_PASSWORD" create_database hubzilla "$HUBZILLA_ADMIN_PASSWORD"
if ! grep -q "$HUBZILLA_PATH" /etc/crontab; then if ! grep -q "$HUBZILLA_PATH" /etc/crontab; then
echo "12,22,32,42,52 * * * * root cd $HUBZILLA_PATH; /usr/bin/timeout 500 /usr/bin/php include/poller.php" >> /etc/crontab echo "12,22,32,42,52 * * * * root cd $HUBZILLA_PATH; /usr/bin/timeout 500 /usr/bin/php include/poller.php" >> /etc/crontab
fi fi
function check add_ddns_domain function check add_ddns_domain
add_ddns_domain $HUBZILLA_DOMAIN_NAME add_ddns_domain $HUBZILLA_DOMAIN_NAME
if [[ $ONION_ONLY == "no" ]]; then if [[ $ONION_ONLY == "no" ]]; then
function_check nginx_http_redirect function_check nginx_http_redirect
nginx_http_redirect $HUBZILLA_DOMAIN_NAME nginx_http_redirect $HUBZILLA_DOMAIN_NAME
echo 'server {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME echo 'server {' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
echo ' listen 443 ssl;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME echo ' listen 443 ssl;' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
@ -301,10 +318,10 @@ function install_hubzilla {
echo '}' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME echo '}' >> /etc/nginx/sites-available/$HUBZILLA_DOMAIN_NAME
fi fi
function_check configure_php function_check configure_php
configure_php configure_php
function_check create_site_certificate function_check create_site_certificate
create_site_certificate $HUBZILLA_DOMAIN_NAME 'yes' create_site_certificate $HUBZILLA_DOMAIN_NAME 'yes'
if [ ! -d $HUBZILLA_PATH/view/tpl/smarty3 ]; then if [ ! -d $HUBZILLA_PATH/view/tpl/smarty3 ]; then
@ -329,12 +346,12 @@ function install_hubzilla {
function_check backup_databases_script_header function_check backup_databases_script_header
backup_databases_script_header backup_databases_script_header
function_check backup_database_local function_check backup_database_local
backup_database_local hubzilla backup_database_local hubzilla
chown -R www-data:www-data $HUBZILLA_PATH chown -R www-data:www-data $HUBZILLA_PATH
function_check nginx_ensite function_check nginx_ensite
nginx_ensite $HUBZILLA_DOMAIN_NAME nginx_ensite $HUBZILLA_DOMAIN_NAME
# initialize the database # initialize the database