mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-23 16:59:26 -05:00
0969d688e3
Make sure that users' changes to the config files are preserved. Fixes #4440.
57 lines
1.6 KiB
Bash
57 lines
1.6 KiB
Bash
#!/bin/sh -e
|
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
CONFIGFILE_SERVERNAME="/etc/matrix-synapse/conf.d/server_name.yaml"
|
|
CONFIGFILE_REPORTSTATS="/etc/matrix-synapse/conf.d/report_stats.yaml"
|
|
USER="matrix-synapse"
|
|
|
|
case "$1" in
|
|
configure|reconfigure)
|
|
|
|
# generate template config files if they don't exist
|
|
mkdir -p "/etc/matrix-synapse/conf.d/"
|
|
if [ ! -e "$CONFIGFILE_SERVERNAME" ]; then
|
|
cat > "$CONFIGFILE_SERVERNAME" <<EOF
|
|
# This file is autogenerated, and will be recreated on upgrade if it is deleted.
|
|
# Any changes you make will be preserved.
|
|
|
|
# The domain name of the server, with optional explicit port.
|
|
# This is used by remote servers to connect to this server,
|
|
# e.g. matrix.org, localhost:8080, etc.
|
|
# This is also the last part of your UserID.
|
|
#
|
|
server_name: ''
|
|
EOF
|
|
fi
|
|
|
|
if [ ! -e "$CONFIGFILE_REPORTSTATS" ]; then
|
|
cat > "$CONFIGFILE_REPORTSTATS" <<EOF
|
|
# This file is autogenerated, and will be recreated on upgrade if it is deleted.
|
|
# Any changes you make will be preserved.
|
|
|
|
# Whether to report anonymized homeserver usage statistics.
|
|
report_stats: false
|
|
EOF
|
|
fi
|
|
|
|
# update the config files according to whatever is in the debconf database
|
|
/opt/venvs/matrix-synapse/lib/manage_debconf.pl update
|
|
|
|
if ! getent passwd $USER >/dev/null; then
|
|
adduser --quiet --system --no-create-home --home /var/lib/matrix-synapse $USER
|
|
fi
|
|
|
|
for DIR in /var/lib/matrix-synapse /var/log/matrix-synapse /etc/matrix-synapse; do
|
|
if ! dpkg-statoverride --list --quiet $DIR >/dev/null; then
|
|
dpkg-statoverride --force --quiet --update --add $USER nogroup 0755 $DIR
|
|
fi
|
|
done
|
|
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|