2017-12-14 18:03:01 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
2020-04-11 02:27:49 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
2017-12-14 18:03:01 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2021-02-14 22:37:29 +01:00
|
|
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
2017-12-14 18:03:01 +01:00
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2020-06-26 15:58:57 +02:00
|
|
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
|
|
|
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
2020-06-13 23:58:57 +02:00
|
|
|
db_user=$db_name
|
2020-06-26 15:58:57 +02:00
|
|
|
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
|
|
|
data_path=$(ynh_app_setting_get --app="$app" --key=data_path)
|
2017-12-14 18:03:01 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
2019-03-12 18:10:10 +01:00
|
|
|
# REMOVE THE POSTGRESQL DATABASE
|
2017-12-14 18:03:01 +01:00
|
|
|
#=================================================
|
2021-02-14 22:37:29 +01:00
|
|
|
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
|
2019-03-12 18:10:10 +01:00
|
|
|
|
2017-12-14 18:03:01 +01:00
|
|
|
# Remove a database if it exists, along with the associated user
|
2020-06-13 23:58:57 +02:00
|
|
|
ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name"
|
2017-12-14 18:03:01 +01:00
|
|
|
|
2019-03-12 18:10:10 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
2021-02-14 22:37:29 +01:00
|
|
|
ynh_script_progression --message="Removing dependencies..." --weight=1
|
2019-03-12 18:10:10 +01:00
|
|
|
|
|
|
|
# Remove metapackage and its dependencies
|
|
|
|
ynh_remove_app_dependencies
|
2017-12-14 18:03:01 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE APP MAIN DIR
|
|
|
|
#=================================================
|
2021-02-14 22:37:29 +01:00
|
|
|
ynh_script_progression --message="Removing Moodle main directory..." --weight=2
|
2017-12-14 18:03:01 +01:00
|
|
|
|
|
|
|
# Remove the app directory securely
|
2020-03-24 02:27:29 +01:00
|
|
|
ynh_secure_remove --file="$final_path"
|
2017-12-14 18:03:01 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2021-02-14 22:37:29 +01:00
|
|
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
2017-12-14 18:03:01 +01:00
|
|
|
|
2020-10-13 16:09:29 +02:00
|
|
|
# Remove the dedicated NGINX config
|
2017-12-14 18:03:01 +01:00
|
|
|
ynh_remove_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
2019-03-12 18:10:10 +01:00
|
|
|
# REMOVE PHP-FPM CONFIGURATION
|
2017-12-14 18:03:01 +01:00
|
|
|
#=================================================
|
2020-10-09 14:27:52 +02:00
|
|
|
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=20
|
2017-12-14 18:03:01 +01:00
|
|
|
|
|
|
|
# Remove the dedicated php-fpm config
|
2019-03-13 21:39:39 +01:00
|
|
|
ynh_remove_fpm_config
|
2020-03-27 14:17:52 +01:00
|
|
|
|
2017-12-14 18:03:01 +01:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC REMOVE
|
|
|
|
#=================================================
|
2020-06-13 23:58:57 +02:00
|
|
|
# REMOVE VARIOUS FILES
|
2017-12-14 18:03:01 +01:00
|
|
|
#=================================================
|
2021-02-14 22:37:29 +01:00
|
|
|
ynh_script_progression --message="Removing various files..." --weight=2
|
2017-12-14 18:03:01 +01:00
|
|
|
|
|
|
|
# Remove a cron file
|
2020-03-24 02:27:29 +01:00
|
|
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
2017-12-14 18:03:01 +01:00
|
|
|
|
|
|
|
# Remove a directory securely
|
2020-03-24 15:27:09 +01:00
|
|
|
ynh_secure_remove --file="$data_path"
|
2017-12-14 18:03:01 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
2021-02-14 22:37:29 +01:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
2017-12-14 18:03:01 +01:00
|
|
|
|
|
|
|
# Delete a system user
|
2021-02-14 22:37:29 +01:00
|
|
|
ynh_system_user_delete --username=$app
|
2019-03-12 18:10:10 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2020-10-13 18:55:21 +02:00
|
|
|
ynh_script_progression --message="Removal of Moodle completed" --last
|