diff --git a/scripts/remove b/scripts/remove index 3f147ca..9423376 100755 --- a/scripts/remove +++ b/scripts/remove @@ -16,12 +16,20 @@ 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 +#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 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 #================================================= @@ -46,10 +54,10 @@ ynh_remove_systemd_config #================================================= # 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 -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_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="/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 #================================================= -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 -ynh_remove_nginx_config +#ynh_remove_nginx_config #================================================= # 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 -ynh_remove_fpm_config +#ynh_remove_fpm_config #================================================= # REMOVE LOGROTATE CONFIGURATION @@ -99,19 +109,19 @@ ynh_remove_logrotate # CLOSE A PORT #================================================= -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi +#if yunohost firewall list | grep -q "\- $port$" +#then +# ynh_script_progression --message="Closing port $port..." +# ynh_exec_warn_less yunohost firewall disallow TCP $port +#fi #================================================= # 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 -ynh_remove_fail2ban_config +#ynh_remove_fail2ban_config #================================================= # SPECIFIC REMOVE @@ -120,13 +130,13 @@ ynh_remove_fail2ban_config #================================================= # Remove a cron file -ynh_secure_remove --file="/etc/cron.d/$app" +#ynh_secure_remove --file="/etc/cron.d/$app" # Remove a directory securely -ynh_secure_remove --file="/etc/$app/" +#ynh_secure_remove --file="/etc/$app/" # Remove the log files -ynh_secure_remove --file="/var/log/$app/" +#ynh_secure_remove --file="/var/log/$app/" #================================================= # 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 # Delete a system user -ynh_system_user_delete --username=$app +ynh_system_user_delete --username=$mautrix_whatsapp_user #================================================= # END OF SCRIPT