1
0

matrix-synapse-py3.postinst 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh -e
  2. . /usr/share/debconf/confmodule
  3. CONFIGFILE_SERVERNAME="/etc/matrix-synapse/conf.d/server_name.yaml"
  4. CONFIGFILE_REPORTSTATS="/etc/matrix-synapse/conf.d/report_stats.yaml"
  5. USER="matrix-synapse"
  6. case "$1" in
  7. configure|reconfigure)
  8. # generate template config files if they don't exist
  9. mkdir -p "/etc/matrix-synapse/conf.d/"
  10. if [ ! -e "$CONFIGFILE_SERVERNAME" ]; then
  11. cat > "$CONFIGFILE_SERVERNAME" <<EOF
  12. # This file is autogenerated, and will be recreated on upgrade if it is deleted.
  13. # Any changes you make will be preserved.
  14. # The domain name of the server, with optional explicit port.
  15. # This is used by remote servers to connect to this server,
  16. # e.g. matrix.org, localhost:8080, etc.
  17. # This is also the last part of your UserID.
  18. #
  19. server_name: ''
  20. EOF
  21. fi
  22. if [ ! -e "$CONFIGFILE_REPORTSTATS" ]; then
  23. cat > "$CONFIGFILE_REPORTSTATS" <<EOF
  24. # This file is autogenerated, and will be recreated on upgrade if it is deleted.
  25. # Any changes you make will be preserved.
  26. # Whether to report anonymized homeserver usage statistics.
  27. report_stats: false
  28. EOF
  29. fi
  30. # update the config files according to whatever is in the debconf database
  31. /opt/venvs/matrix-synapse/lib/manage_debconf.pl update
  32. if ! getent passwd $USER >/dev/null; then
  33. adduser --quiet --system --no-create-home --home /var/lib/matrix-synapse $USER
  34. fi
  35. for DIR in /var/lib/matrix-synapse /var/log/matrix-synapse /etc/matrix-synapse; do
  36. if ! dpkg-statoverride --list --quiet $DIR >/dev/null; then
  37. dpkg-statoverride --force --quiet --update --add $USER nogroup 0755 $DIR
  38. fi
  39. done
  40. ;;
  41. esac
  42. #DEBHELPER#
  43. exit 0