2017-01-28 22:50:08 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-03-24 01:27:49 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
2017-01-29 16:25:11 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2018-03-24 01:27:49 +01:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
2020-03-31 17:43:53 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
|
|
|
|
2018-03-24 01:27:49 +01:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2020-03-31 17:43:53 +02:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
2018-03-24 01:27:49 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
|
|
|
|
2020-03-31 17:43:53 +02:00
|
|
|
ynh_script_progression --message="Removing logrotate configuration..."
|
2018-03-24 01:27:49 +01:00
|
|
|
# Remove metapackage and its dependencies
|
|
|
|
ynh_remove_app_dependencies
|
|
|
|
|
2020-03-31 20:50:30 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE THE MYSQL DATABASE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removing the MySQL database..." --weight=5
|
|
|
|
|
|
|
|
# Remove a database if it exists, along with the associated user
|
|
|
|
ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
|
|
|
|
|
2018-03-24 01:27:49 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE APP MAIN DIR
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Remove the app directory securely
|
|
|
|
ynh_secure_remove "$final_path"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Remove the dedicated nginx config
|
|
|
|
ynh_remove_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Remove the dedicated php-fpm config
|
|
|
|
ynh_remove_fpm_config
|
2017-01-28 22:50:08 +01:00
|
|
|
|
2020-03-31 20:50:30 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE LOGROTATE CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removing logrotate configuration..."
|
|
|
|
|
|
|
|
# Remove the app-specific logrotate config
|
|
|
|
ynh_remove_logrotate
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CLEAN ACL IN HOME DIRECTORIES
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
for i in $(ls /home); do
|
|
|
|
# Clean ACL in every directories in /home, except those which start with 'yunohost.'
|
|
|
|
[[ ! $i == yunohost.* ]] \
|
|
|
|
&& setfacl --remove g:$app:rwx 2>&1
|
|
|
|
done
|
|
|
|
|
2018-03-24 01:27:49 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
2020-03-31 17:43:53 +02:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user..."
|
2017-01-28 22:50:08 +01:00
|
|
|
|
2018-03-24 01:27:49 +01:00
|
|
|
# Delete a system user
|
|
|
|
ynh_system_user_delete $app
|
2020-03-31 17:43:53 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|