1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/grav_ynh.git synced 2024-09-03 19:16:01 +02:00
grav_ynh/scripts/remove

33 lines
895 B
Text
Raw Normal View History

2015-11-11 18:03:16 +01:00
#!/bin/bash
2017-03-02 15:44:54 +01:00
# Exit on command errors and treat unset variables as an error
set -u
2015-11-11 18:03:16 +01:00
2017-03-10 22:10:45 +01:00
# Get multi-instances specific variables
2017-03-02 15:44:54 +01:00
app=$YNH_APP_INSTANCE_NAME
2017-03-10 22:10:45 +01:00
# Source app helpers
. /usr/share/yunohost/helpers
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
with_mysql=$(ynh_app_setting_get "$app" with_mysql)
# Drop MySQL database and user as needed
if [[ $with_mysql -eq 1 ]]; then
dbname=$app
dbuser=$app
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
ynh_mysql_drop_db $dbname || true
ynh_mysql_drop_user $dbuser || true
fi
# Delete app directory and configurations
sudo rm -rf "/var/www/${app}"
sudo rm -f "/etc/php5/fpm/pool.d/${app}.conf"
sudo rm -f "/etc/php5/fpm/conf.d/20-${app}.ini"
[[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
# Reload services
sudo service php5-fpm restart || true
sudo service nginx reload || true