1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/UMS_ynh.git synced 2024-10-01 13:35:01 +02:00

Init remove

This commit is contained in:
Krakinou 2021-04-10 20:08:08 +02:00
parent df6e471aed
commit 1af61adb34

View file

@ -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"