2017-02-13 20:43:41 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
source ./psql.sh
|
|
|
|
|
|
|
|
# Stop script if errors
|
|
|
|
set -u
|
|
|
|
|
2017-02-13 20:43:41 +01:00
|
|
|
# Import common cmd
|
|
|
|
source ./_common.sh
|
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Retrieve app settings
|
|
|
|
domain=$(ynh_app_setting_get $app special_domain)
|
|
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
2017-02-13 20:43:41 +01:00
|
|
|
synapse_tls_port=$(ynh_app_setting_get $app synapse_tls_port)
|
|
|
|
turnserver_tls_port=$(ynh_app_setting_get $app turnserver_tls_port)
|
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
systemctl stop matrix-synapse.service || true
|
|
|
|
systemctl stop coturn.service || true
|
2017-02-13 20:43:41 +01:00
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Suppression de la configuration nginx
|
|
|
|
ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
systemctl reload nginx.service
|
2017-02-13 20:43:41 +01:00
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Close firewall ports
|
2017-02-13 20:43:41 +01:00
|
|
|
closeport() {
|
2017-07-21 22:28:49 +02:00
|
|
|
if yunohost firewall list | grep -q "\- $port$"
|
2017-02-13 20:43:41 +01:00
|
|
|
then
|
|
|
|
echo "Close port $port"
|
2017-07-21 22:28:49 +02:00
|
|
|
yunohost firewall disallow TCP $port > /dev/null
|
2017-02-13 20:43:41 +01:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
port=$synapse_tls_port
|
|
|
|
closeport
|
|
|
|
port=$turnserver_tls_port
|
|
|
|
closeport
|
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# 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
|
2017-12-08 21:57:33 +01:00
|
|
|
ynh_secure_remove /var/log/turnserver
|
2017-07-21 22:28:49 +02:00
|
|
|
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
|
2017-12-20 21:24:32 +01:00
|
|
|
ynh_psql_remove_db $synapse_db_name $synapse_db_user
|
2017-07-21 22:28:49 +02:00
|
|
|
|
|
|
|
# Remove user
|
|
|
|
ynh_system_user_delete matrix-synapse
|
|
|
|
|
|
|
|
# Remove logrotate
|
|
|
|
ynh_remove_logrotate
|
2017-02-13 20:43:41 +01:00
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Remove Monitoring
|
|
|
|
yunohost service remove matrix-synapse
|
2017-05-26 15:29:12 +02:00
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Reload nginx
|
|
|
|
systemctl reload nginx.service
|
2017-02-13 20:43:41 +01:00
|
|
|
|