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
|
|
|
|
|
|
|
|
# Stop script if errors
|
|
|
|
set -u
|
|
|
|
|
2017-02-13 20:43:41 +01:00
|
|
|
# Import common cmd
|
2018-01-25 19:33:20 +01:00
|
|
|
source ./psql.sh
|
|
|
|
source ./experimental_helper.sh
|
2017-02-13 20:43:41 +01:00
|
|
|
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)
|
2018-01-19 22:05:39 +01:00
|
|
|
turnserver_alt_tls_port=$(ynh_app_setting_get $app turnserver_alt_tls_port)
|
2017-02-13 20:43:41 +01:00
|
|
|
|
2018-01-19 22:05:39 +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
|
|
|
|
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"
|
2018-01-19 22:05:39 +01:00
|
|
|
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
|
2018-01-19 22:05:39 +01:00
|
|
|
port=$turnserver_alt_tls_port
|
|
|
|
closeport
|
2017-02-13 20:43:41 +01:00
|
|
|
|
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
|
2018-01-19 22:05:39 +01:00
|
|
|
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
|
2017-07-21 22:28:49 +02:00
|
|
|
|
|
|
|
# Remove systemd service
|
2018-01-25 19:33:20 +01:00
|
|
|
ynh_remove_systemd_config matrix-$YNH_APP_INSTANCE_NAME
|
|
|
|
ynh_remove_systemd_config coturn-$YNH_APP_INSTANCE_NAME
|
2017-07-21 22:28:49 +02:00
|
|
|
|
|
|
|
# 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
|
2018-01-19 22:05:39 +01:00
|
|
|
ynh_system_user_delete matrix-$YNH_APP_INSTANCE_NAME
|
2017-07-21 22:28:49 +02:00
|
|
|
|
|
|
|
# Remove logrotate
|
|
|
|
ynh_remove_logrotate
|
2017-02-13 20:43:41 +01:00
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Remove Monitoring
|
2018-01-19 22:05:39 +01:00
|
|
|
yunohost service remove matrix-$YNH_APP_INSTANCE_NAME
|