2015-08-23 17:33:13 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-04-30 20:24:17 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2015-08-23 17:33:13 +02:00
|
|
|
|
2018-04-30 20:24:17 +02:00
|
|
|
source _common.sh
|
2017-02-17 13:10:19 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
2015-08-23 17:33:13 +02:00
|
|
|
|
2018-04-30 20:24:17 +02:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2022-10-16 22:06:33 +02:00
|
|
|
ynh_script_progression --message="Loading settings..." --weight=1
|
2019-04-04 18:32:01 +02:00
|
|
|
|
2023-06-04 10:58:53 +02:00
|
|
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
2018-04-30 20:24:17 +02:00
|
|
|
|
2023-06-04 10:58:53 +02:00
|
|
|
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
|
|
#REMOVEME? db_user=$db_name
|
|
|
|
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
|
|
|
#REMOVEME? database=$(ynh_app_setting_get --app=$app --key=database)
|
2020-10-14 04:28:54 +02:00
|
|
|
|
2018-04-30 20:24:17 +02:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
2022-07-13 17:22:05 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE LOGROTATE CONFIGURATION
|
|
|
|
#=================================================
|
2022-10-16 22:06:33 +02:00
|
|
|
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
2022-07-13 17:22:05 +02:00
|
|
|
|
|
|
|
# Remove the app-specific logrotate config
|
|
|
|
ynh_remove_logrotate
|
|
|
|
|
2018-04-30 20:24:17 +02:00
|
|
|
#=================================================
|
2020-10-14 04:28:54 +02:00
|
|
|
# REMOVE THE DATABASE
|
2018-04-30 20:24:17 +02:00
|
|
|
#=================================================
|
2020-11-13 11:25:58 +01:00
|
|
|
|
2022-07-13 17:22:05 +02:00
|
|
|
if [ $database = "mysql" ]; then
|
2020-11-13 11:25:58 +01:00
|
|
|
# Removing MySQL database
|
2023-06-04 10:58:53 +02:00
|
|
|
#REMOVEME? ynh_script_progression --message="Removing MySQL database..." --weight=1
|
|
|
|
#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
2022-07-13 17:22:05 +02:00
|
|
|
elif [ $database = "postgresql" ]; then
|
2020-11-13 11:25:58 +01:00
|
|
|
# Removing PostgreSQL database
|
2023-06-04 10:58:53 +02:00
|
|
|
#REMOVEME? ynh_script_progression --message="Removing PostgreSQL database..." --weight=1
|
|
|
|
#REMOVEME? ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
2020-10-14 04:28:54 +02:00
|
|
|
fi
|
2018-04-30 20:24:17 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE APP MAIN DIR
|
|
|
|
#=================================================
|
2023-06-04 10:58:53 +02:00
|
|
|
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
|
2017-02-17 13:10:19 +01:00
|
|
|
|
2018-04-30 20:24:17 +02:00
|
|
|
# Remove the app directory securely
|
2023-06-04 10:58:53 +02:00
|
|
|
#REMOVEME? ynh_secure_remove --file="$install_dir"
|
2017-02-17 13:10:19 +01:00
|
|
|
|
2018-04-30 20:24:17 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2022-10-16 22:06:33 +02:00
|
|
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
2017-02-17 13:10:19 +01:00
|
|
|
|
2020-11-13 16:59:16 +01:00
|
|
|
# Remove the dedicated NGINX config
|
2018-04-30 20:24:17 +02:00
|
|
|
ynh_remove_nginx_config
|
2017-02-17 13:10:19 +01:00
|
|
|
|
2018-04-30 20:24:17 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
2022-10-16 22:06:33 +02:00
|
|
|
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
|
2015-08-23 17:33:13 +02:00
|
|
|
|
2020-11-13 16:59:16 +01:00
|
|
|
# Remove the dedicated PHP-FPM config
|
2018-04-30 20:24:17 +02:00
|
|
|
ynh_remove_fpm_config
|
2015-08-23 17:33:13 +02:00
|
|
|
|
2019-04-04 18:32:01 +02:00
|
|
|
#=================================================
|
2022-07-13 17:22:05 +02:00
|
|
|
# REMOVE DEPENDENCIES
|
2019-04-04 18:32:01 +02:00
|
|
|
#=================================================
|
2023-06-04 10:58:53 +02:00
|
|
|
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1
|
2019-04-04 18:32:01 +02:00
|
|
|
|
2022-07-13 17:22:05 +02:00
|
|
|
# Remove metapackage and its dependencies
|
2023-06-04 10:58:53 +02:00
|
|
|
#REMOVEME? ynh_remove_app_dependencies
|
2019-04-04 18:32:01 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-07-13 17:22:05 +02:00
|
|
|
# REMOVE FAIL2BAN CONFIGURATION
|
2019-04-04 18:32:01 +02:00
|
|
|
#=================================================
|
2022-10-16 22:06:33 +02:00
|
|
|
ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=1
|
2017-02-17 13:10:19 +01:00
|
|
|
|
2022-07-13 17:22:05 +02:00
|
|
|
# Remove the dedicated Fail2Ban config
|
|
|
|
ynh_remove_fail2ban_config
|
2020-04-23 00:03:42 +02:00
|
|
|
|
2018-11-08 11:08:11 +01:00
|
|
|
#=================================================
|
2022-07-13 17:22:05 +02:00
|
|
|
# SPECIFIC REMOVE
|
2018-11-08 11:08:11 +01:00
|
|
|
#=================================================
|
2022-07-13 17:22:05 +02:00
|
|
|
# REMOVE VARIOUS FILES
|
|
|
|
#=================================================
|
2022-10-16 22:06:33 +02:00
|
|
|
ynh_script_progression --message="Removing various files..." --weight=1
|
2018-11-08 11:08:11 +01:00
|
|
|
|
2022-07-13 17:22:05 +02:00
|
|
|
# Remove a cron file
|
|
|
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
2018-11-08 11:08:11 +01:00
|
|
|
|
2018-04-30 20:24:17 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
2023-06-04 10:58:53 +02:00
|
|
|
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
2017-02-17 13:10:19 +01:00
|
|
|
|
2018-04-30 20:24:17 +02:00
|
|
|
# Delete a system user
|
2023-06-04 10:58:53 +02:00
|
|
|
#REMOVEME? ynh_system_user_delete --username=$app
|
2019-04-04 18:32:01 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2022-10-16 22:06:33 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|