2014-05-10 11:54:15 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-05-01 15:47:20 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2014-05-10 11:54:15 +02:00
|
|
|
|
2019-03-03 20:32:26 +01:00
|
|
|
source _common.sh
|
2017-05-01 15:47:20 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
2016-07-04 21:16:34 +02:00
|
|
|
|
2017-05-01 15:47:20 +02:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2019-05-18 20:15:36 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
2016-07-04 21:16:34 +02:00
|
|
|
|
2017-05-01 15:47:20 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2016-07-04 21:16:34 +02:00
|
|
|
|
2019-05-18 20:15:36 +02:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
2017-05-01 15:47:20 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
|
|
|
# STOP AND REMOVE SERVICE
|
|
|
|
#=================================================
|
2019-08-05 12:04:07 +02:00
|
|
|
ynh_script_progression --message="Stopping and removing the systemd service..."
|
2017-05-01 15:47:20 +02:00
|
|
|
|
2017-08-28 03:03:36 +02:00
|
|
|
# Remove the uwsgi configuration
|
2019-03-03 20:32:26 +01:00
|
|
|
ynh_systemd_action --service_name=uwsgi --action=stop
|
|
|
|
if [ -h "/etc/uwsgi/apps-enabled/$app.ini" ]
|
|
|
|
then
|
2019-05-18 20:15:36 +02:00
|
|
|
ynh_print_info --message="Delete uwsgi config for $app"
|
|
|
|
ynh_secure_remove --file="/etc/uwsgi/apps-enabled/$app.ini"
|
2017-05-01 15:47:20 +02:00
|
|
|
fi
|
2019-05-18 20:15:36 +02:00
|
|
|
ynh_secure_remove --file="/etc/uwsgi/apps-available/$app.ini"
|
2017-05-01 15:47:20 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
2019-08-05 12:04:07 +02:00
|
|
|
ynh_script_progression --message="Removing dependencies..." --weight=3
|
2017-05-01 15:47:20 +02:00
|
|
|
|
|
|
|
ynh_remove_app_dependencies
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE THE MAIN DIR OF THE APP
|
|
|
|
#=================================================
|
2019-05-18 20:15:36 +02:00
|
|
|
ynh_script_progression --message="Removing app main directory..."
|
2017-05-01 15:47:20 +02:00
|
|
|
|
2019-05-18 20:15:36 +02:00
|
|
|
ynh_secure_remove --file="$final_path"
|
2017-05-01 15:47:20 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE THE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2019-05-18 20:15:36 +02:00
|
|
|
ynh_script_progression --message="Removing nginx web server configuration..." --weight=2
|
2017-05-01 15:47:20 +02:00
|
|
|
|
2017-08-28 03:03:36 +02:00
|
|
|
# Remove the dedicated nginx config
|
|
|
|
ynh_remove_nginx_config
|
2017-05-01 15:47:20 +02:00
|
|
|
|
|
|
|
#=================================================
|
2019-03-03 20:32:26 +01:00
|
|
|
# REMOVE SERVICE FROM ADMIN PANEL
|
2017-05-01 15:47:20 +02:00
|
|
|
#=================================================
|
|
|
|
|
|
|
|
if [ -e /etc/init.d/uwsgi ]
|
|
|
|
then
|
|
|
|
# Redémarre le service uwsgi si il n'est pas désinstallé.
|
2019-03-03 20:32:26 +01:00
|
|
|
ynh_systemd_action --service_name=uwsgi --action=start
|
2017-05-01 15:47:20 +02:00
|
|
|
else
|
2019-03-03 20:32:26 +01:00
|
|
|
if yunohost service status | grep -q uwsgi
|
2017-05-01 15:47:20 +02:00
|
|
|
then
|
2019-05-18 20:15:36 +02:00
|
|
|
ynh_print_info --message="Remove uwsgi service"
|
2017-08-28 03:03:36 +02:00
|
|
|
yunohost service remove uwsgi
|
2017-05-01 15:47:20 +02:00
|
|
|
fi
|
2016-07-05 12:25:33 +02:00
|
|
|
fi
|
2016-07-05 12:49:44 +02:00
|
|
|
|
2017-05-01 15:47:20 +02:00
|
|
|
#=================================================
|
2019-03-03 20:32:26 +01:00
|
|
|
# GENERIC FINALIZATION
|
2017-05-01 15:47:20 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
2019-05-18 20:15:36 +02:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user..."
|
2016-07-05 12:49:44 +02:00
|
|
|
|
2017-08-28 03:03:36 +02:00
|
|
|
# Delete a system user
|
2019-05-18 20:15:36 +02:00
|
|
|
ynh_system_user_delete --username=$app
|
2019-03-03 20:33:02 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2019-05-18 20:15:36 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|