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
2020-12-07 09:05:15 +01:00

114 lines
3.4 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Load settings"
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stop and remove the service" --weight=3
# Delete uwsgi configuration
ynh_systemd_action --action=stop --service_name=uwsgi
if [ -h "/etc/uwsgi/apps-enabled/radicale.ini" ]; then
echo "Delete uwsgi config"
ynh_secure_remove "/etc/uwsgi/apps-enabled/radicale.ini"
fi
ynh_secure_remove "/etc/uwsgi/apps-available/radicale.ini"
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Remove dependencies" --weight=10
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Remove app main directory"
ynh_secure_remove "/var/www/$app"
ynh_secure_remove "/opt/yunohost/$app"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Remove NGINX configuration"
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Remove PHP-FPM configuration" --weight=3
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
#=================================================
# REMOVE LOGROTATE CONFIG
#=================================================
ynh_script_progression --message="Remove logrotate configuration" --weight=3
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE RADICALE CONFIG
#=================================================
ynh_secure_remove "/etc/$app"
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
if [ -e /etc/init.d/uwsgi ]
then
# Restart uwsgi service
ynh_systemd_action --action=start --service_name=uwsgi
else
# Check if the service is declared in YunoHost
if yunohost service status | grep -q uwsgi
then
ynh_print_info "Remove uwsgi service" >&2
yunohost service remove uwsgi
fi
fi
#=================================================
# GENERIC FINALISATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Remove the dedicated user"
ynh_system_user_delete $app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Deletion completed" --last