mirror of
https://github.com/YunoHost-Apps/synapse_ynh.git
synced 2024-09-03 20:26:38 +02:00
115 lines
3.2 KiB
Bash
Executable file
115 lines
3.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Import common cmd
|
|
source ./psql.sh
|
|
source ./experimental_helper.sh
|
|
source ./_common.sh
|
|
|
|
#=================================================
|
|
# 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
|
|
#=================================================
|
|
|
|
domain=$(ynh_app_setting_get $app special_domain)
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
|
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)
|
|
|
|
#=================================================
|
|
# STANDARD REMOVE
|
|
#=================================================
|
|
# STOP AND REMOVE SERVICE
|
|
#=================================================
|
|
|
|
ynh_remove_systemd_config matrix-$app
|
|
ynh_remove_systemd_config coturn-$app
|
|
|
|
#=================================================
|
|
# CLOSE A PORT
|
|
#=================================================
|
|
|
|
closeport() {
|
|
local port=$1
|
|
if yunohost firewall list | grep -q "\- $port$"
|
|
then
|
|
echo "Close port $port"
|
|
yunohost firewall disallow Both $port > /dev/null
|
|
fi
|
|
}
|
|
|
|
closeport $synapse_tls_port
|
|
closeport $turnserver_tls_port
|
|
closeport $turnserver_alt_tls_port
|
|
|
|
#=================================================
|
|
# SETUP SSOWAT
|
|
#=================================================
|
|
|
|
# Remove the skipped url
|
|
python $final_path/remove_sso_conf.py
|
|
|
|
#=================================================
|
|
# REMOVE DEPENDENCIES
|
|
#=================================================
|
|
|
|
ynh_remove_app_dependencies
|
|
|
|
#=================================================
|
|
# REMOVE APP DIR
|
|
#=================================================
|
|
|
|
ynh_secure_remove $final_path
|
|
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
|
|
|
|
#=================================================
|
|
# REMOVE NGINX CONFIGURATION
|
|
#=================================================
|
|
|
|
ynh_remove_nginx_config
|
|
|
|
#=================================================
|
|
# REMOVE THE POSTGRESQL DATABASE
|
|
#=================================================
|
|
|
|
ynh_psql_remove_db $synapse_db_name $synapse_db_user
|
|
|
|
#=================================================
|
|
# REMOVE DEDICATED USER
|
|
#=================================================
|
|
|
|
ynh_system_user_delete $synapse_user
|
|
|
|
#=================================================
|
|
# REMOVE LOGROTATE CONFIGURATION
|
|
#=================================================
|
|
|
|
ynh_remove_logrotate
|
|
|
|
#=================================================
|
|
# REMOVE SERVICE FROM ADMIN PANEL
|
|
#=================================================
|
|
|
|
yunohost service remove matrix-$app
|
|
yunohost service remove coturn-$app
|