1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mautrix_whatsapp_ynh.git synced 2024-09-03 19:46:01 +02:00

Update remove

This commit is contained in:
Gredin67 2020-04-19 19:16:28 +02:00 committed by GitHub
parent accc5fdd43
commit 98e8d3006f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,12 +16,20 @@ ynh_script_progression --message="Loading installation settings..." --time --wei
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port) #port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) #db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name #db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# SET CONSTANTS
#=================================================
mautrix_whatsapp_user=$app
#mautrix_whatsapp_db_name=$app
#mautrix_whatsapp_db_user=$app
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
@ -46,10 +54,10 @@ ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE THE MYSQL DATABASE # REMOVE THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Removing the MySQL database..." --time --weight=1 ynh_script_progression --message="Removing the PostgreSQL database..." --time --weight=1
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
ynh_psql_drop_db $app ynh_psql_drop_db $app
ynh_psql_drop_user $app ynh_psql_drop_user $app
@ -70,22 +78,24 @@ ynh_script_progression --message="Removing app main directory..." --time --weigh
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
ynh_secure_remove --file="/etc/matrix-synapse/$app-registration.yaml" ynh_secure_remove --file="/etc/matrix-synapse/$app-registration.yaml"
ynh_replace_string --match_string=" - '/etc/matrix-synapse/$app-registration.yaml'" --replace_string="# - app_service_1.yaml" --target_file="/etc/matrix-synapse/homeserver.yaml"
service matrix-synapse restart
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1 #ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config #ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE PHP-FPM CONFIGURATION # REMOVE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=1 #ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=1
# Remove the dedicated php-fpm config # Remove the dedicated php-fpm config
ynh_remove_fpm_config #ynh_remove_fpm_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE LOGROTATE CONFIGURATION
@ -99,19 +109,19 @@ ynh_remove_logrotate
# CLOSE A PORT # CLOSE A PORT
#================================================= #=================================================
if yunohost firewall list | grep -q "\- $port$" #if yunohost firewall list | grep -q "\- $port$"
then #then
ynh_script_progression --message="Closing port $port..." # ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port # ynh_exec_warn_less yunohost firewall disallow TCP $port
fi #fi
#================================================= #=================================================
# REMOVE FAIL2BAN CONFIGURATION # REMOVE FAIL2BAN CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing fail2ban configuration..." --time --weight=1 #ynh_script_progression --message="Removing fail2ban configuration..." --time --weight=1
# Remove the dedicated fail2ban config # Remove the dedicated fail2ban config
ynh_remove_fail2ban_config #ynh_remove_fail2ban_config
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
@ -120,13 +130,13 @@ ynh_remove_fail2ban_config
#================================================= #=================================================
# Remove a cron file # Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app" #ynh_secure_remove --file="/etc/cron.d/$app"
# Remove a directory securely # Remove a directory securely
ynh_secure_remove --file="/etc/$app/" #ynh_secure_remove --file="/etc/$app/"
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app/" #ynh_secure_remove --file="/var/log/$app/"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -136,7 +146,7 @@ ynh_secure_remove --file="/var/log/$app/"
ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app ynh_system_user_delete --username=$mautrix_whatsapp_user
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT