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/sources/update_synapse_for_appservice.sh
Nathanaël 77aca763d6
chg: fix user in update_synapse_for_appservice.sh
Since the migration to the packaging v2 in https://github.com/YunoHost-Apps/synapse_ynh/pull/426 the system user for this app is $app and not matrix-$app anymore.
2024-04-17 15:41:08 +02:00

34 lines
892 B
Bash

#!/bin/bash
set -eu
app=__APP__
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
if [ -n "$(ls /etc/matrix-$app/app-service/)" ]; then
echo "app_service_config_files:" > $service_config_file
else
echo "" > $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
# Set permissions
chown $app $service_config_file
chown $app /etc/matrix-$app/app-service/*
chmod 600 $service_config_file
chmod 600 /etc/matrix-$app/app-service/*
systemctl restart $app.service
if [ $? -eq 0 ]; then
rm /tmp/app_service_backup.yaml
exit 0
else
echo "Failed to restart synapse with the new config file. Restore the old config file !!"
cp /tmp/app_service_backup.yaml $service_config_file
fi