2018-12-10 18:14:34 +01:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2021-10-22 00:50:21 +02:00
|
|
|
# shellcheck disable=SC1091
|
2018-12-10 18:14:34 +01:00
|
|
|
. /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)
|
|
|
|
|
2019-02-22 16:02:39 +01:00
|
|
|
# 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
|
2018-12-10 18:14:34 +01:00
|
|
|
fi
|
|
|
|
|
2019-02-22 16:02:39 +01:00
|
|
|
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.
|
|
|
|
|
2022-07-19 14:38:29 +02:00
|
|
|
# Whether to report homeserver usage statistics.
|
2019-02-22 16:02:39 +01:00
|
|
|
report_stats: false
|
|
|
|
EOF
|
2018-12-10 18:14:34 +01:00
|
|
|
fi
|
|
|
|
|
2019-02-22 16:02:39 +01:00
|
|
|
# update the config files according to whatever is in the debconf database
|
|
|
|
/opt/venvs/matrix-synapse/lib/manage_debconf.pl update
|
|
|
|
|
2018-12-10 18:14:34 +01:00
|
|
|
if ! getent passwd $USER >/dev/null; then
|
2022-08-25 18:56:55 +02:00
|
|
|
adduser --quiet --system --group --no-create-home --home /var/lib/matrix-synapse $USER
|
2018-12-10 18:14:34 +01:00
|
|
|
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
|
2022-08-31 12:15:28 +02:00
|
|
|
dpkg-statoverride --force-statoverride-add --quiet --update --add $USER "$(id -gn $USER)" 0755 $DIR
|
2018-12-10 18:14:34 +01:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#DEBHELPER#
|
|
|
|
|
|
|
|
exit 0
|