From c2e4d0ea5dff604a0b0dcf67975c40377af62857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Tue, 3 Sep 2019 15:26:09 +0200 Subject: [PATCH] Add hook to restart synapse at each certificate update --- hooks/post_cert_update | 5 +++++ scripts/backup | 7 +++++++ scripts/install | 9 +++++++++ scripts/upgrade | 9 +++++++++ 4 files changed, 30 insertions(+) create mode 100644 hooks/post_cert_update diff --git a/hooks/post_cert_update b/hooks/post_cert_update new file mode 100644 index 0000000..91d776e --- /dev/null +++ b/hooks/post_cert_update @@ -0,0 +1,5 @@ +#!/bin/bash + +if [ $1 == __DOMAIN__ ]; then + systemctl restart matrix-__APP__ +fi diff --git a/scripts/backup b/scripts/backup index 15161d4..d6e1933 100644 --- a/scripts/backup +++ b/scripts/backup @@ -80,6 +80,13 @@ ynh_psql_dump_db "$synapse_db_name" > ${YNH_CWD}/dump.sql ynh_backup "/var/log/matrix-$app" +#================================================= +# BACKUP HOOKS +#================================================= + +# Copy hook +ynh_backup --src_path "/etc/yunohost/hooks.d/post_cert_update/50-$app" + #================================================= # BACKUP FAIL2BAN CONFIG #================================================= diff --git a/scripts/install b/scripts/install index d231a5c..625cc40 100644 --- a/scripts/install +++ b/scripts/install @@ -315,6 +315,15 @@ ynh_replace_string __APP__ $app "$final_path/Coturn_config_rotate.sh" # The script "add_sso_conf.py" will just add en entry for the path "/_matrix" in the sso conf.json.persistent file in the cathegory "skipped_urls". python3 ../conf/add_sso_conf.py || ynh_die "Your file /etc/ssowat/conf.json.persistent doesn't respect the json syntax. Please fix the syntax to install this app. For more information see here: https://github.com/YunoHost-Apps/synapse_ynh/issues/32" +#================================================= +# UPDATE HOOKS +#================================================= + +# WARNING : theses command are used in INSTALL, UPGRADE +# For any update do it in all files +ynh_replace_string __APP__ $app ../hooks/post_cert_update +ynh_replace_string __DOMAIN__ $domain ../hooks/post_cert_update + #================================================= # SECURE FILES AND DIRECTORIES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2cba4c9..2753742 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -334,6 +334,15 @@ chmod 600 /etc/matrix-$app/$domain.signing.key setfacl -R -m user:turnserver:rX /etc/matrix-$app setfacl -R -m user:turnserver:rwX /var/log/matrix-$app +#================================================= +# UPDATE HOOKS +#================================================= + +# WARNING : theses command are used in INSTALL, UPGRADE +# For any update do it in all files +ynh_replace_string __APP__ $app ../hooks/post_cert_update +ynh_replace_string __DOMAIN__ $domain ../hooks/post_cert_update + #================================================= # UPDATE VERSION SETTINGS #=================================================