2016-03-28 22:14:19 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-06-02 17:15:57 +02:00
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -u
|
2016-03-28 22:14:19 +02:00
|
|
|
|
2017-06-02 17:15:57 +02:00
|
|
|
if [ ! -e _common.sh ]; then
|
|
|
|
# Get file fonction if not been to the current directory
|
|
|
|
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
|
|
|
sudo chmod a+rx _common.sh
|
|
|
|
fi
|
2016-03-28 22:14:19 +02:00
|
|
|
# Source app helpers
|
2017-06-02 17:15:57 +02:00
|
|
|
source ./_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Get multi-instances specific variables
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
2016-03-28 22:14:19 +02:00
|
|
|
|
|
|
|
# Drop MySQL database and user
|
2017-06-02 17:15:57 +02:00
|
|
|
dbname=$app
|
|
|
|
dbuser=$app
|
2016-05-22 22:55:22 +02:00
|
|
|
ynh_mysql_drop_db "$dbname" 2>&1 || true
|
|
|
|
ynh_mysql_drop_user "$dbuser" 2>&1 || true
|
2016-03-28 22:14:19 +02:00
|
|
|
|
2017-06-02 17:15:57 +02:00
|
|
|
ynh_secure_remove /var/www/$app
|
|
|
|
ynh_secure_remove /etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
ynh_remove_fpm_config
|
2016-03-28 22:14:19 +02:00
|
|
|
|
2017-06-02 17:15:57 +02:00
|
|
|
ynh_system_user_delete $app
|
2016-03-28 22:14:19 +02:00
|
|
|
|
2017-06-02 17:15:57 +02:00
|
|
|
sudo systemctl reload nginx
|
2016-05-17 13:15:38 +02:00
|
|
|
|
|
|
|
# Remove app dependencies
|
2016-05-22 22:55:22 +02:00
|
|
|
if ynh_package_is_installed "$DEPS_PKG_NAME"; then
|
|
|
|
ynh_package_autoremove "$DEPS_PKG_NAME"
|
|
|
|
fi
|