1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00
synapse_ynh/scripts/remove

74 lines
1.7 KiB
Text
Raw Normal View History

2017-02-13 20:43:41 +01:00
#!/bin/bash
# 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
# 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)
systemctl stop matrix-synapse.service || true
systemctl stop coturn.service || true
2017-02-13 20:43:41 +01: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
# Close firewall ports
2017-02-13 20:43:41 +01:00
closeport() {
if yunohost firewall list | grep -q "\- $port$"
2017-02-13 20:43:41 +01:00
then
echo "Close port $port"
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
# 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 /var/log/turnserver
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
# Remove user
ynh_system_user_delete matrix-synapse
# Remove logrotate
ynh_remove_logrotate
2017-02-13 20:43:41 +01:00
# Remove Monitoring
yunohost service remove matrix-synapse
2017-05-26 15:29:12 +02:00
# Reload nginx
systemctl reload nginx.service
2017-02-13 20:43:41 +01:00