2015-03-19 20:49:50 +01:00
|
|
|
#!/bin/bash
|
2015-11-18 00:28:42 +01:00
|
|
|
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-06-15 23:56:45 +02:00
|
|
|
|
2017-03-21 00:44:14 +01:00
|
|
|
source _common.sh
|
2016-11-08 13:33:28 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
2016-05-20 00:01:21 +02:00
|
|
|
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2020-01-02 18:40:15 +01:00
|
|
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
2017-03-19 19:16:10 +01:00
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2020-01-02 18:40:15 +01:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
2015-03-26 13:07:01 +01:00
|
|
|
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
|
|
|
# STOP AND REMOVE SERVICE
|
|
|
|
#=================================================
|
2020-01-02 18:40:15 +01:00
|
|
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=6
|
2017-03-19 19:16:10 +01:00
|
|
|
|
2019-01-18 19:56:43 +01:00
|
|
|
# Remove the dedicated systemd config
|
2017-05-24 16:48:26 +02:00
|
|
|
ynh_remove_systemd_config
|
2016-05-20 00:01:21 +02:00
|
|
|
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
2019-01-18 19:56:43 +01:00
|
|
|
# REMOVE SERVICE FROM ADMIN PANEL
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
|
|
|
|
2019-01-18 19:56:43 +01:00
|
|
|
# Check if the service is declared in YunoHost
|
2019-12-09 18:08:42 +01:00
|
|
|
if ynh_exec_fully_quiet yunohost service status $app
|
2016-05-20 00:01:21 +02:00
|
|
|
then
|
2020-01-02 18:40:15 +01:00
|
|
|
ynh_script_progression --message="Removing $app service..."
|
2017-09-05 00:25:58 +02:00
|
|
|
yunohost service remove $app
|
2016-03-31 22:41:54 +02:00
|
|
|
fi
|
2015-03-26 13:07:01 +01:00
|
|
|
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
2020-01-02 18:40:15 +01:00
|
|
|
ynh_script_progression --message="Removing dependencies..." --weight=20
|
2017-03-19 19:16:10 +01:00
|
|
|
|
2019-01-18 19:56:43 +01:00
|
|
|
# Remove metapackage and its dependencies
|
2017-03-19 19:16:10 +01:00
|
|
|
ynh_remove_app_dependencies
|
|
|
|
|
|
|
|
#=================================================
|
2019-01-18 19:56:43 +01:00
|
|
|
# REMOVE APP MAIN DIR
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
2020-01-02 18:40:15 +01:00
|
|
|
ynh_script_progression --message="Removing app main directory..." --weight=2
|
2017-03-19 19:16:10 +01:00
|
|
|
|
2019-01-18 19:56:43 +01:00
|
|
|
# Remove the app directory securely
|
2020-01-02 18:40:15 +01:00
|
|
|
ynh_secure_remove --file="$final_path"
|
2015-11-18 00:28:42 +01:00
|
|
|
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
2019-01-18 19:56:43 +01:00
|
|
|
# REMOVE NGINX CONFIGURATION
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
2020-01-02 18:40:15 +01:00
|
|
|
ynh_script_progression --message="Removing nginx web server configuration..."
|
2017-03-19 19:16:10 +01:00
|
|
|
|
2019-01-18 19:56:43 +01:00
|
|
|
# Remove the dedicated nginx config
|
|
|
|
ynh_remove_nginx_config
|
2015-11-18 00:28:42 +01:00
|
|
|
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
2019-01-18 19:56:43 +01:00
|
|
|
# REMOVE LOGROTATE CONFIGURATION
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
2020-01-02 18:40:15 +01:00
|
|
|
ynh_script_progression --message="Removing logrotate configuration..."
|
2017-03-19 19:16:10 +01:00
|
|
|
|
2019-01-18 19:56:43 +01:00
|
|
|
# Remove the app-specific logrotate config
|
|
|
|
ynh_remove_logrotate
|
2017-03-19 19:16:10 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC REMOVE
|
|
|
|
#=================================================
|
2019-01-18 19:56:43 +01:00
|
|
|
# REMOVE CRON JOB
|
2017-03-19 19:16:10 +01:00
|
|
|
#=================================================
|
|
|
|
|
2020-01-02 18:40:15 +01:00
|
|
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
2019-01-30 16:19:40 +01:00
|
|
|
|
2019-01-31 11:53:55 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
2020-01-02 18:40:15 +01:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user..." --weight=5
|
2019-01-31 11:53:55 +01:00
|
|
|
|
|
|
|
# Delete dedicated system user
|
2020-01-02 18:40:15 +01:00
|
|
|
ynh_system_user_delete --username=$app
|
2019-01-31 11:53:55 +01:00
|
|
|
|
2019-01-30 16:19:40 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2020-04-24 20:16:33 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|