2016-04-07 00:00:41 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
# GENERIC START
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-06-15 23:57:31 +02:00
|
|
|
|
2017-03-20 00:17:59 +01:00
|
|
|
source _common.sh
|
2016-11-08 13:38:29 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
2016-04-07 00:00:41 +02:00
|
|
|
|
2017-03-19 18:36:20 +01:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2016-11-08 13:13:35 +01:00
|
|
|
|
2020-12-07 09:05:15 +01:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
2022-03-18 22:47:33 +01:00
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
2016-11-08 13:13:35 +01:00
|
|
|
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
2022-03-18 22:47:33 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing $app service integration..."
|
|
|
|
yunohost service remove $app
|
|
|
|
fi
|
|
|
|
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
|
|
|
# STOP AND REMOVE SERVICE
|
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
ynh_script_progression --message="Stopping and removing the systemd service..."
|
2016-04-07 00:00:41 +02:00
|
|
|
|
2022-11-22 13:40:41 +01:00
|
|
|
ynh_remove_systemd_config
|
2016-05-20 00:03:02 +02:00
|
|
|
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
# REMOVE LOGROTATE CONFIGURATION
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
ynh_script_progression --message="Removing logrotate configuration..."
|
2017-03-19 18:36:20 +01:00
|
|
|
|
2022-03-18 22:47:33 +01:00
|
|
|
# Remove the app-specific logrotate config
|
|
|
|
ynh_remove_logrotate
|
2017-03-19 18:36:20 +01:00
|
|
|
|
|
|
|
#=================================================
|
2019-01-18 21:12:58 +01:00
|
|
|
# REMOVE APP MAIN DIR
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
ynh_script_progression --message="Removing app main directory..."
|
2017-03-19 18:36:20 +01:00
|
|
|
|
2022-03-18 22:47:33 +01:00
|
|
|
# Remove the app directory securely
|
|
|
|
ynh_secure_remove --file="$final_path"
|
|
|
|
ynh_secure_remove --file="/opt/yunohost/$app"
|
2017-03-19 18:36:20 +01:00
|
|
|
|
|
|
|
#=================================================
|
2019-01-18 21:12:58 +01:00
|
|
|
# REMOVE NGINX CONFIGURATION
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
ynh_script_progression --message="Removing NGINX web server configuration..."
|
2016-04-07 00:00:41 +02:00
|
|
|
|
2020-12-07 09:05:15 +01:00
|
|
|
# Remove the dedicated NGINX config
|
2019-01-18 21:12:58 +01:00
|
|
|
ynh_remove_nginx_config
|
2016-04-07 00:00:41 +02:00
|
|
|
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
2019-01-18 21:12:58 +01:00
|
|
|
# REMOVE PHP-FPM CONFIGURATION
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
ynh_script_progression --message="Removing PHP-FPM configuration..."
|
2017-03-19 18:36:20 +01:00
|
|
|
|
2022-03-18 22:47:33 +01:00
|
|
|
# Remove the dedicated PHP-FPM config
|
2019-01-18 21:12:58 +01:00
|
|
|
ynh_remove_fpm_config
|
2016-04-07 00:00:41 +02:00
|
|
|
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
# REMOVE DEPENDENCIES
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
ynh_script_progression --message="Removing dependencies..."
|
2017-03-19 18:36:20 +01:00
|
|
|
|
2022-03-18 22:47:33 +01:00
|
|
|
# Remove metapackage and its dependencies
|
|
|
|
ynh_remove_app_dependencies
|
2017-03-19 18:36:20 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC REMOVE
|
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
# REMOVE VARIOUS FILES
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
ynh_script_progression --message="Removing various files..."
|
2017-03-19 18:36:20 +01:00
|
|
|
|
2022-03-18 22:47:33 +01:00
|
|
|
# Remove a directory securely
|
|
|
|
ynh_secure_remove --file="/etc/$app"
|
2016-04-07 00:00:41 +02:00
|
|
|
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
# GENERIC FINALIZATION
|
2017-03-19 18:36:20 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
2022-03-18 22:47:33 +01:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user..."
|
2016-04-07 00:00:41 +02:00
|
|
|
|
2022-03-18 22:47:33 +01:00
|
|
|
# Delete a system user
|
|
|
|
ynh_system_user_delete --username=$app
|
2019-01-30 19:16:04 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2022-03-18 22:47:33 +01:00
|
|
|
ynh_script_progression --message="Removal of $app completed"
|