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

72 lines
1.8 KiB
Text
Raw Normal View History

2017-02-13 20:43:41 +01:00
#!/bin/bash
# Source YunoHost helpers
source /usr/share/yunohost/helpers
# Stop script if errors
set -u
2017-02-13 20:43:41 +01:00
# Import common cmd
source ./psql.sh
source ./experimental_helper.sh
2017-02-13 20:43:41 +01:00
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)
turnserver_alt_tls_port=$(ynh_app_setting_get $app turnserver_alt_tls_port)
2017-02-13 20:43:41 +01:00
systemctl stop matrix-$YNH_APP_INSTANCE_NAME.service || true
systemctl stop coturn-$app.service || true
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 Both $port > /dev/null
2017-02-13 20:43:41 +01:00
fi
}
port=$synapse_tls_port
closeport
port=$turnserver_tls_port
closeport
port=$turnserver_alt_tls_port
closeport
2017-02-13 20:43:41 +01: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-$YNH_APP_INSTANCE_NAME
ynh_secure_remove /var/log/matrix-$YNH_APP_INSTANCE_NAME
ynh_secure_remove /etc/matrix-$YNH_APP_INSTANCE_NAME
ynh_secure_remove /etc/default/matrix-$YNH_APP_INSTANCE_NAME
ynh_secure_remove /etc/default/coturn-$YNH_APP_INSTANCE_NAME
# Remove nginx config
ynh_remove_nginx_config
# Remove systemd service
ynh_remove_systemd_config matrix-$YNH_APP_INSTANCE_NAME
ynh_remove_systemd_config coturn-$YNH_APP_INSTANCE_NAME
# 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-$YNH_APP_INSTANCE_NAME
# Remove logrotate
ynh_remove_logrotate
2017-02-13 20:43:41 +01:00
# Remove Monitoring
yunohost service remove matrix-$YNH_APP_INSTANCE_NAME