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)
|
2017-02-16 22:54:57 +01:00
|
|
|
turnserver_dbpass=$(ynh_app_setting_get "$app" turnserver_mysqlpwd)
|
2017-02-13 20:43:41 +01:00
|
|
|
turnserver_tls_port=$(ynh_app_setting_get $app turnserver_tls_port)
|
|
|
|
turnserver_pwd=$(ynh_app_setting_get $app turnserver_pwd)
|
2017-02-16 22:54:57 +01:00
|
|
|
turnserver_dbuser="turnserver"
|
2017-02-13 20:43:41 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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
|