2017-02-13 20:43:41 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-01-30 23:44:49 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
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
|
|
|
|
|
2018-01-30 23:44:49 +01:00
|
|
|
#=================================================
|
|
|
|
# SET ALL CONSTANT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
synapse_user="matrix-$app"
|
|
|
|
synapse_db_name="matrix_$app"
|
|
|
|
synapse_db_user="matrix_$app"
|
|
|
|
upstream_version=$(ynh_app_upstream_version)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
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-30 23:44:49 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
|
|
|
# STOP AND REMOVE SERVICE
|
|
|
|
#=================================================
|
|
|
|
|
2018-02-03 11:32:59 +01:00
|
|
|
ynh_remove_systemd_config matrix-$app
|
|
|
|
ynh_remove_systemd_config coturn-$app
|
2018-01-30 23:44:49 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CLOSE A PORT
|
|
|
|
#=================================================
|
2017-02-13 20:43:41 +01:00
|
|
|
|
|
|
|
closeport() {
|
2018-02-12 17:34:40 +01:00
|
|
|
local port=$1
|
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
|
|
|
|
}
|
|
|
|
|
2018-02-12 17:34:40 +01:00
|
|
|
closeport $synapse_tls_port
|
|
|
|
closeport $turnserver_tls_port
|
|
|
|
closeport $turnserver_alt_tls_port
|
2017-02-13 20:43:41 +01:00
|
|
|
|
2018-01-30 23:44:49 +01:00
|
|
|
#=================================================
|
|
|
|
# SETUP SSOWAT
|
|
|
|
#=================================================
|
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Remove the skipped url
|
2018-02-24 23:38:31 +01:00
|
|
|
python3 $final_path/remove_sso_conf.py
|
2017-07-21 22:28:49 +02:00
|
|
|
|
2018-01-30 23:44:49 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
|
|
|
|
2018-02-03 11:32:59 +01:00
|
|
|
ynh_remove_app_dependencies
|
2017-07-21 22:28:49 +02:00
|
|
|
|
2018-01-30 23:44:49 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE APP DIR
|
|
|
|
#=================================================
|
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
ynh_secure_remove $final_path
|
2018-02-03 11:32:59 +01:00
|
|
|
ynh_secure_remove /var/lib/matrix-$app
|
|
|
|
ynh_secure_remove /var/log/matrix-$app
|
|
|
|
ynh_secure_remove /etc/matrix-$app
|
|
|
|
ynh_secure_remove /etc/default/matrix-$app
|
|
|
|
ynh_secure_remove /etc/default/coturn-$app
|
2018-01-19 22:05:39 +01:00
|
|
|
|
2018-01-30 23:44:49 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
2018-01-19 22:05:39 +01:00
|
|
|
ynh_remove_nginx_config
|
2017-07-21 22:28:49 +02:00
|
|
|
|
2018-01-30 23:44:49 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE THE POSTGRESQL DATABASE
|
|
|
|
#=================================================
|
2017-07-21 22:28:49 +02:00
|
|
|
|
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
|
|
|
|
2018-01-30 23:44:49 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
|
|
|
|
2018-02-03 11:32:59 +01:00
|
|
|
ynh_system_user_delete $synapse_user
|
2017-07-21 22:28:49 +02:00
|
|
|
|
2018-01-30 23:44:49 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE LOGROTATE CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
ynh_remove_logrotate
|
2017-02-13 20:43:41 +01:00
|
|
|
|
2018-01-30 23:44:49 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE SERVICE FROM ADMIN PANEL
|
|
|
|
#=================================================
|
|
|
|
|
2018-02-03 11:32:59 +01:00
|
|
|
yunohost service remove matrix-$app
|
2018-02-12 17:34:40 +01:00
|
|
|
yunohost service remove coturn-$app
|