From 230839d5889e59dcb76e940310d93261a0272eee Mon Sep 17 00:00:00 2001 From: frju365 Date: Sun, 11 Feb 2018 19:47:08 +0100 Subject: [PATCH] Big Refactoring --- scripts/remove | 50 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/scripts/remove b/scripts/remove index 9b336a3..1801a3f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,12 +1,12 @@ #!/bin/bash #================================================= -# GENERIC STARTING +# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= -source .fonctions +source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -17,40 +17,58 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) db_name=$(ynh_app_setting_get $app db_name) +db_user=$db_name +final_path=$(ynh_app_setting_get $app final_path) #================================================= # STANDARD REMOVE #================================================= -# REMOVE THE SQL BDD +# REMOVE DEPENDENCIES #================================================= -ynh_mysql_remove_db $db_name $db_name # Suppression de la base de donnée et de l'utilisateur associé. +# Remove metapackage and its dependencies +ynh_remove_app_dependencies #================================================= -# REMOVE THE MAIN DIR OF THE APP +# REMOVE THE MYSQL DATABASE #================================================= -SECURE_REMOVE '/var/www/$app' # Suppression du dossier de l'application +# Remove a database if it exists, along with the associated user +ynh_mysql_remove_db $db_user $db_name #================================================= -# REMOVE THE NGINX CONFIGURATION +# REMOVE APP MAIN DIR #================================================= -REMOVE_NGINX_CONF # Suppression de la configuration nginx +# Remove the app directory securely +ynh_secure_remove "$final_path" #================================================= -# REMOVE THE PHP-FPM CONFIGURATION +# REMOVE NGINX CONFIGURATION #================================================= -REMOVE_FPM_CONF # Suppression de la configuration du pool php-fpm +# Remove the dedicated nginx config +ynh_remove_nginx_config #================================================= -# SPECIFIC REMOVE -#================================================= -# Remove app dependencies +# REMOVE PHP-FPM CONFIGURATION #================================================= -if ynh_package_is_installed "abantecart-deps"; then - ynh_package_autoremove "abantecart-deps" -fi +# Remove the dedicated php-fpm config +ynh_remove_fpm_config +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= + +# Remove the app-specific logrotate config +ynh_remove_logrotate + +#================================================= +# GENERIC FINALIZATION +#================================================= +# REMOVE DEDICATED USER +#================================================= + +# Delete a system user +ynh_system_user_delete $app