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/upgrade

68 lines
2.4 KiB
Text
Raw Normal View History

2017-02-13 20:43:41 +01:00
#!/bin/bash
# Import common cmd
source ./_common.sh
# Init script
init_script
# Retrieve arguments
domain=$(ynh_app_setting_get $app domain)
path=$(ynh_app_setting_get $app path)
is_public=$(ynh_app_setting_get $app is_public)
synapse_port=$(ynh_app_setting_get $app synapse_port)
synapse_tls_port=$(ynh_app_setting_get $app synapse_tls_port)
turnserver_tls_port=$(ynh_app_setting_get $app turnserver_tls_port)
turnserver_pwd=$(ynh_app_setting_get $app turnserver_pwd)
CHECK_PATH # Vérifie et corrige la syntaxe du path.
if [[ -n "$(uname -m | grep arm)" ]]
then
install_arm_package_dep
fi
# Et copie le fichier de config nginx
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Modifie les variables dans le fichier de configuration nginx
sudo sed -i "s@__PATH__@$path@g" /etc/nginx/conf.d/$domain.d/$app.conf
sudo sed -i "s@__PORT__@$synapse_port@g" /etc/nginx/conf.d/$domain.d/$app.conf
# Configure Synapse
sudo cp ../conf/homeserver.yaml /etc/matrix-synapse/homeserver.yaml
sudo sed -i "s@__DOMAIN__@$domain@g" /etc/matrix-synapse/homeserver.yaml
sudo sed -i "s@__PORT__@$synapse_port@g" /etc/matrix-synapse/homeserver.yaml
sudo sed -i "s@__TLS_PORT__@$synapse_tls_port@g" /etc/matrix-synapse/homeserver.yaml
sudo sed -i "s@__TURNSERVER_TLS_PORT__@$turnserver_tls_port@g" /etc/matrix-synapse/homeserver.yaml
sudo sed -i "s@__TURNPWD__@$turnserver_pwd@g" /etc/matrix-synapse/homeserver.yaml
2017-02-18 22:40:22 +01:00
# Configure access for certificates
set_access matrix-synapse /etc/yunohost/certs/$domain/crt.pem
set_access matrix-synapse /etc/yunohost/certs/$domain/key.pem
set_access matrix-synapse /etc/yunohost/certs/$domain/dh.pem
set_access turnserver /etc/yunohost/certs/$domain/crt.pem
set_access turnserver /etc/yunohost/certs/$domain/key.pem
set_access turnserver /etc/yunohost/certs/$domain/dh.pem
2017-02-13 20:43:41 +01:00
if [ "$is_public" = "0" ]
then
sudo sed -i "s@__ALLOWED_ACCESS__@False@g" /etc/matrix-synapse/homeserver.yaml
else
sudo sed -i "s@__ALLOWED_ACCESS__@True@g" /etc/matrix-synapse/homeserver.yaml
fi
# Configure Coturn
sudo cp ../conf/turnserver.conf /etc/turnserver.conf
sudo sed -i "s@__TURNPWD__@$turnserver_pwd@g" /etc/turnserver.conf
sudo sed -i "s@__DOMAIN__@$domain@g" /etc/turnserver.conf
sudo sed -i "s@__TLS_PORT__@$turnserver_tls_port@g" /etc/turnserver.conf
# Régénère la configuration de SSOwat
sudo yunohost app ssowatconf
# Recharge la configuration Nginx
sudo service nginx reload
sudo service matrix-synapse restart
sudo service coturn restart