From b1968a55cb1ab413e5c4a7e2b1082760a7fae6d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 25 May 2023 12:38:09 +0200 Subject: [PATCH] Fix app_service config file --- scripts/install | 2 +- scripts/upgrade | 2 +- sources/update_synapse_for_appservice.sh | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index bc8587a..d29754c 100644 --- a/scripts/install +++ b/scripts/install @@ -184,7 +184,7 @@ mkdir -p $data_path mkdir -p /var/log/matrix-$app mkdir -p /etc/matrix-$app/conf.d mkdir -p /etc/matrix-$app/app-service -echo "app_service_config_files:" > /etc/matrix-$app/conf.d/app_service.yaml +touch /etc/matrix-$app/conf.d/app_service.yaml # Install synapse in virtualenv install_sources diff --git a/scripts/upgrade b/scripts/upgrade index 7d26ac9..e78c188 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -380,7 +380,7 @@ ynh_add_config --template="../sources/update_synapse_for_appservice.sh" --destin # Ensure app-service folder has exists and the config file exit (Migration) mkdir -p /etc/matrix-$app/app-service -test -e /etc/matrix-$app/conf.d/app_service.yaml || echo "app_service_config_files:" > /etc/matrix-$app/conf.d/app_service.yaml +test -e /etc/matrix-$app/conf.d/app_service.yaml || touch /etc/matrix-$app/conf.d/app_service.yaml #================================================= # ADVERTISE SERVICE IN ADMIN PANEL diff --git a/sources/update_synapse_for_appservice.sh b/sources/update_synapse_for_appservice.sh index 193b1f0..fda5ddb 100644 --- a/sources/update_synapse_for_appservice.sh +++ b/sources/update_synapse_for_appservice.sh @@ -6,7 +6,9 @@ service_config_file=/etc/matrix-$app/conf.d/app_service.yaml # Backup the previous config file cp $service_config_file /tmp/app_service_backup.yaml -echo "app_service_config_files:" > $service_config_file +if [ -n "$(ls /etc/matrix-$app/app-service/)" ]; then + echo "app_service_config_files:" > $service_config_file +fi for f in $(ls /etc/matrix-$app/app-service/); do echo " - /etc/matrix-$app/app-service/$f" >> $service_config_file done