2019-12-14 15:15:25 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
source ./experimental_helper.sh
source ./_common.sh
2023-11-01 18:52:07 +01:00
source /usr/share/yunohost/helpers
2019-12-14 15:15:25 +01:00
2023-11-01 18:52:07 +01:00
path=$new_path
domain=$new_domain
2019-12-14 15:15:25 +01:00
# Check if the new path stay /_matrix if not exit
2023-10-31 22:19:40 +01:00
if [[ $path != "/_matrix" ]]
2019-12-14 15:15:25 +01:00
then
ynh_die --message "You can't use an other path than '/_matrix'. You can only change the domain."
fi
2023-11-01 18:52:07 +01:00
# We stop the service
2024-02-06 20:42:00 +01:00
ynh_systemd_action --service_name=$app.service.service --action=stop
2019-12-14 15:15:25 +01:00
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# NGINX CONFIGURATION
#=================================================
2022-10-28 10:59:40 +02:00
ynh_script_progression --message="Updating NGINX configuration..."
2019-12-14 15:15:25 +01:00
2023-10-31 22:19:40 +01:00
ynh_change_url_nginx_config
2023-11-01 18:52:07 +01:00
configure_nginx
2019-12-14 15:15:25 +01:00
#=================================================
# UPDATE SYNAPSE CONFIG
#=================================================
2022-10-28 10:59:40 +02:00
ynh_script_progression --message="Updating Synapse config..." --weight=2
2019-12-14 15:15:25 +01:00
2023-11-01 18:52:07 +01:00
configure_synapse
2019-12-14 15:15:25 +01:00
2022-02-21 21:03:01 +01:00
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
2023-11-01 18:52:07 +01:00
ynh_script_progression --message="Protecting directories..." --weight=3
set_permissions
2022-02-21 21:03:01 +01:00
2019-12-14 15:15:25 +01:00
#=================================================
# RELOAD SERVICES
#=================================================
2022-10-28 10:59:40 +02:00
ynh_script_progression --message="Restarting Synapse services..." --weight=5
2019-12-14 15:15:25 +01:00
2024-02-06 20:42:00 +01:00
ynh_systemd_action --service_name=$app-coturn.service --action=restart
ynh_systemd_action --service_name=$app.service --action=restart --line_match="Synapse now listening on TCP port $port_synapse_tls" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300
2019-12-14 15:15:25 +01:00
ynh_script_progression --message="Change of URL completed for $app" --last