1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/roundcube_ynh.git synced 2024-09-03 20:16:28 +02:00
roundcube_ynh/scripts/remove
2017-07-14 22:23:08 +02:00

39 lines
No EOL
989 B
Bash

#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -u
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
# Source app helpers
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)
# Drop MySQL database and user
dbname=$app
dbuser=$app
ynh_mysql_drop_db "$dbname" 2>&1 || true
ynh_mysql_drop_user "$dbuser" 2>&1 || true
ynh_secure_remove /var/www/$app
ynh_secure_remove /etc/nginx/conf.d/$domain.d/$app.conf
ynh_remove_fpm_config
ynh_system_user_delete $app
sudo systemctl reload nginx
# Remove app dependencies
ynh_remove_app_dependencies $app
# The following command is kept as a matter of transition with the previous way
# of managing dependencies
ynh_package_autoremove "roundcube-deps" || true