#!/bin/bash # Source YunoHost helpers source /usr/share/yunohost/helpers source ./psql.sh # Stop script if errors set -u # Import common cmd source ./_common.sh # Retrieve app settings domain=$(ynh_app_setting_get $app special_domain) final_path=$(ynh_app_setting_get $app final_path) synapse_tls_port=$(ynh_app_setting_get $app synapse_tls_port) turnserver_tls_port=$(ynh_app_setting_get $app turnserver_tls_port) systemctl stop matrix-synapse.service || true systemctl stop coturn.service || true # Suppression de la configuration nginx ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf" systemctl reload nginx.service # Close firewall ports closeport() { if yunohost firewall list | grep -q "\- $port$" then echo "Close port $port" yunohost firewall disallow TCP $port > /dev/null fi } port=$synapse_tls_port closeport port=$turnserver_tls_port closeport # Remove the skipped url python $final_path/remove_sso_conf.py # Remove depandance ynh_remove_app_dependencies || true # Clean all directory ynh_secure_remove $final_path ynh_secure_remove /var/lib/matrix-synapse ynh_secure_remove /var/log/matrix-synapse ynh_secure_remove /etc/matrix-synapse ynh_secure_remove /etc/default/matrix-synapse # Remove systemd service systemctl disable matrix-synapse.service ynh_secure_remove /etc/systemd/system/matrix-synapse.service systemctl daemon-reload # Remove database and user ynh_psql_drop_db $synapse_db_name ynh_psql_drop_user $synapse_db_user # Remove user ynh_system_user_delete matrix-synapse # Remove logrotate ynh_remove_logrotate # Remove Monitoring yunohost service remove matrix-synapse # Reload nginx systemctl reload nginx.service