1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/radicale_ynh.git synced 2024-09-03 20:16:14 +02:00
radicale_ynh/scripts/remove

115 lines
3.4 KiB
Text
Raw Normal View History

2016-04-07 00:00:41 +02:00
#!/bin/bash
2017-03-19 18:36:20 +01:00
#=================================================
# GENERIC STARTING
#=================================================
# 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
#=================================================
2019-01-30 19:16:04 +01:00
ynh_script_progression --message="Load 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
2017-03-19 18:36:20 +01:00
domain=$(ynh_app_setting_get $app domain)
2016-11-08 13:13:35 +01:00
2017-03-19 18:36:20 +01:00
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
2019-01-30 19:16:04 +01:00
ynh_script_progression --message="Stop and remove the service" --weight=3
2016-04-07 00:00:41 +02:00
2019-01-18 21:12:58 +01:00
# Delete uwsgi configuration
ynh_systemd_action --action=stop --service_name=uwsgi
2016-06-22 14:11:25 +02:00
if [ -h "/etc/uwsgi/apps-enabled/radicale.ini" ]; then
2016-05-20 00:03:02 +02:00
echo "Delete uwsgi config"
2017-06-13 22:28:52 +02:00
ynh_secure_remove "/etc/uwsgi/apps-enabled/radicale.ini"
2016-05-20 00:03:02 +02:00
fi
2017-06-13 22:28:52 +02:00
ynh_secure_remove "/etc/uwsgi/apps-available/radicale.ini"
2016-05-20 00:03:02 +02:00
2017-03-19 18:36:20 +01:00
#=================================================
# REMOVE DEPENDENCIES
#=================================================
2019-01-30 19:16:04 +01:00
ynh_script_progression --message="Remove dependencies" --weight=10
2017-03-19 18:36:20 +01:00
2019-01-18 21:12:58 +01:00
# Remove metapackage and its dependencies
2017-03-19 18:36:20 +01:00
ynh_remove_app_dependencies
#=================================================
2019-01-18 21:12:58 +01:00
# REMOVE APP MAIN DIR
2017-03-19 18:36:20 +01:00
#=================================================
2019-01-30 19:16:04 +01:00
ynh_script_progression --message="Remove app main directory"
2017-03-19 18:36:20 +01:00
2019-01-18 21:12:58 +01:00
ynh_secure_remove "/var/www/$app"
2017-06-13 22:28:52 +02:00
ynh_secure_remove "/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
#=================================================
2019-01-30 19:16:04 +01:00
ynh_script_progression --message="Remove nginx configuration"
2016-04-07 00:00:41 +02:00
2019-01-18 21:12:58 +01:00
# Remove the dedicated nginx config
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
#=================================================
2019-01-30 19:16:04 +01:00
ynh_script_progression --message="Remove php-fpm configuration" --weight=3
2017-03-19 18:36:20 +01:00
2019-01-18 21:12:58 +01:00
# Remove the dedicated php-fpm config
ynh_remove_fpm_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 LOGROTATE CONFIG
2017-03-19 18:36:20 +01:00
#=================================================
2019-01-30 19:16:04 +01:00
ynh_script_progression --message="Remove logrotate configuration" --weight=3
2017-03-19 18:36:20 +01:00
2019-01-18 21:12:58 +01:00
# Remove the app-specific logrotate config
ynh_remove_logrotate
2017-03-19 18:36:20 +01:00
#=================================================
# SPECIFIC REMOVE
#=================================================
2019-01-18 21:12:58 +01:00
# REMOVE RADICALE CONFIG
2017-03-19 18:36:20 +01:00
#=================================================
2019-01-18 21:12:58 +01:00
ynh_secure_remove "/etc/$app"
2017-03-19 18:36:20 +01:00
#=================================================
2019-01-18 21:12:58 +01:00
# REMOVE SERVICE FROM ADMIN PANEL
2017-03-19 18:36:20 +01:00
#=================================================
if [ -e /etc/init.d/uwsgi ]
then
2019-01-18 21:12:58 +01:00
# Restart uwsgi service
ynh_systemd_action --action=start --service_name=uwsgi
2017-03-19 18:36:20 +01:00
else
2019-01-18 21:12:58 +01:00
# Check if the service is declared in YunoHost
if yunohost service status | grep -q uwsgi
2017-03-19 18:36:20 +01:00
then
2017-12-16 23:29:00 +01:00
ynh_print_info "Remove uwsgi service" >&2
2017-09-05 00:34:00 +02:00
yunohost service remove uwsgi
2017-03-19 18:36:20 +01:00
fi
fi
2016-04-07 00:00:41 +02:00
2017-03-19 18:36:20 +01:00
#=================================================
# GENERIC FINALISATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
2019-01-30 19:16:04 +01:00
ynh_script_progression --message="Remove the dedicated user"
2016-04-07 00:00:41 +02:00
2017-03-19 18:36:20 +01:00
ynh_system_user_delete $app
2019-01-30 19:16:04 +01:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Deletion completed" --last