From 1af61adb343fe356a30e5f2b9fc8e84a60d627ec Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sat, 10 Apr 2021 20:08:08 +0200 Subject: [PATCH] Init remove --- scripts/remove | 47 +++++++++++------------------------------------ 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/scripts/remove b/scripts/remove index 5056b4f..a233d2a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -17,9 +17,8 @@ ynh_script_progression --message="Loading installation settings..." --time --wei app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name +port_web=$(ynh_app_setting_get --app=$app --key=port_web) +port_rend=$(ynh_app_setting_get --app=$app --key=port_rend) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= @@ -43,14 +42,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE THE MYSQL DATABASE -#================================================= -ynh_script_progression --message="Removing the MySQL database..." --time --weight=1 - -# Remove a database if it exists, along with the associated user -ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name - #================================================= # REMOVE DEPENDENCIES #================================================= @@ -75,14 +66,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." --time --weight=1 - -# Remove the dedicated PHP-FPM config -ynh_remove_fpm_config - #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= @@ -92,22 +75,20 @@ ynh_script_progression --message="Removing logrotate configuration..." --time -- ynh_remove_logrotate #================================================= -# CLOSE A PORT +# CLOSE PORTS #================================================= -if yunohost firewall list | grep -q "\- $port$" +if yunohost firewall list | grep -q "\- $port_web$" then - ynh_script_progression --message="Closing port $port..." --time --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $port + ynh_script_progression --message="Closing port $port_web..." --time --weight=1 + ynh_exec_warn_less yunohost firewall disallow TCP $port_web fi -#================================================= -# REMOVE FAIL2BAN CONFIGURATION -#================================================= -ynh_script_progression --message="Removing Fail2ban configuration..." --time --weight=1 - -# Remove the dedicated Fail2Ban config -ynh_remove_fail2ban_config +if yunohost firewall list | grep -q "\- $port_rend$" +then + ynh_script_progression --message="Closing port $port_rend..." --time --weight=1 + ynh_exec_warn_less yunohost firewall disallow TCP $port_rend +fi #================================================= # SPECIFIC REMOVE @@ -115,12 +96,6 @@ ynh_remove_fail2ban_config # REMOVE VARIOUS FILES #================================================= -# Remove a cron file -ynh_secure_remove --file="/etc/cron.d/$app" - -# Remove a directory securely -ynh_secure_remove --file="/etc/$app" - # Remove the log files ynh_secure_remove --file="/var/log/$app"