mirror of
https://github.com/YunoHost-Apps/unattended_upgrades_ynh.git
synced 2024-10-01 13:35:00 +02:00
113 lines
3.2 KiB
Text
113 lines
3.2 KiB
Text
|
#!/bin/bash
|
||
|
|
||
|
#=================================================
|
||
|
# GENERIC STARTING
|
||
|
#=================================================
|
||
|
# IMPORT GENERIC HELPERS
|
||
|
#=================================================
|
||
|
|
||
|
source _common.sh
|
||
|
source /usr/share/yunohost/helpers
|
||
|
|
||
|
#=================================================
|
||
|
# LOAD SETTINGS
|
||
|
#=================================================
|
||
|
|
||
|
app=$YNH_APP_INSTANCE_NAME
|
||
|
|
||
|
domain=$(ynh_app_setting_get $app domain)
|
||
|
port=$(ynh_app_setting_get $app port)
|
||
|
db_name=$(ynh_app_setting_get $app db_name)
|
||
|
|
||
|
#=================================================
|
||
|
# STANDARD REMOVE
|
||
|
#=================================================
|
||
|
# STOP AND REMOVE SERVICE
|
||
|
#=================================================
|
||
|
|
||
|
ynh_remove_systemd_config
|
||
|
|
||
|
#=================================================
|
||
|
# DISABLE SERVICE IN ADMIN PANEL
|
||
|
#=================================================
|
||
|
|
||
|
if yunohost service status | grep -q $app # Test l'existence du service dans Yunohost
|
||
|
then
|
||
|
ynh_print_info "Remove $app service" >&2
|
||
|
yunohost service remove $app
|
||
|
fi
|
||
|
|
||
|
#=================================================
|
||
|
# REMOVE DEPENDENCIES
|
||
|
#=================================================
|
||
|
|
||
|
ynh_remove_app_dependencies
|
||
|
|
||
|
#=================================================
|
||
|
# REMOVE THE SQL BDD
|
||
|
#=================================================
|
||
|
|
||
|
ynh_mysql_remove_db $db_name $db_name # Suppression de la base de donnée et de l'utilisateur associé.
|
||
|
|
||
|
#=================================================
|
||
|
# REMOVE THE MAIN DIR OF THE APP
|
||
|
#=================================================
|
||
|
|
||
|
ynh_secure_remove "/var/www/$app" # Suppression du dossier de l'application
|
||
|
|
||
|
#=================================================
|
||
|
# REMOVE THE NGINX CONFIGURATION
|
||
|
#=================================================
|
||
|
|
||
|
ynh_remove_nginx_config # Suppression de la configuration nginx
|
||
|
|
||
|
#=================================================
|
||
|
# REMOVE THE PHP-FPM CONFIGURATION
|
||
|
#=================================================
|
||
|
|
||
|
ynh_remove_fpm_config # Suppression de la configuration du pool php-fpm
|
||
|
|
||
|
#=================================================
|
||
|
# REMOVE FAIL2BAN CONFIGURATION
|
||
|
#=================================================
|
||
|
|
||
|
ynh_remove_fail2ban_config
|
||
|
|
||
|
#=================================================
|
||
|
# REMOVE THE LOGROTATE CONFIG
|
||
|
#=================================================
|
||
|
|
||
|
ynh_remove_logrotate # Suppression de la configuration de logrotate
|
||
|
|
||
|
#=================================================
|
||
|
# CLOSE A PORT
|
||
|
#=================================================
|
||
|
|
||
|
if yunohost firewall list | grep -q "\- $port$"
|
||
|
then
|
||
|
ynh_print_info "Close port $port" >&2
|
||
|
ynh_exec_quiet yunohost firewall disallow TCP $port
|
||
|
fi
|
||
|
|
||
|
#=================================================
|
||
|
# SPECIFIC REMOVE
|
||
|
#=================================================
|
||
|
# REMOVE THE CRON FILE
|
||
|
#=================================================
|
||
|
|
||
|
ynh_secure_remove "/etc/cron.d/$app"
|
||
|
|
||
|
# Suppression d'un dossier
|
||
|
ynh_secure_remove "/etc/$app/"
|
||
|
|
||
|
# Suppression des log
|
||
|
ynh_secure_remove "/var/log/$app/"
|
||
|
|
||
|
#=================================================
|
||
|
# GENERIC FINALISATION
|
||
|
#=================================================
|
||
|
# REMOVE DEDICATED USER
|
||
|
#=================================================
|
||
|
|
||
|
ynh_system_user_delete $app
|