matrix-synapse-py3.postinst 1011 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. # Set server name in config file
  9. mkdir -p "/etc/matrix-synapse/conf.d/"
  10. db_get matrix-synapse/server-name
  11. if [ "$RET" ]; then
  12. echo "server_name: $RET" > $CONFIGFILE_SERVERNAME
  13. fi
  14. db_get matrix-synapse/report-stats
  15. if [ "$RET" ]; then
  16. echo "report_stats: $RET" > $CONFIGFILE_REPORTSTATS
  17. fi
  18. if ! getent passwd $USER >/dev/null; then
  19. adduser --quiet --system --no-create-home --home /var/lib/matrix-synapse $USER
  20. fi
  21. for DIR in /var/lib/matrix-synapse /var/log/matrix-synapse /etc/matrix-synapse; do
  22. if ! dpkg-statoverride --list --quiet $DIR >/dev/null; then
  23. dpkg-statoverride --force --quiet --update --add $USER nogroup 0755 $DIR
  24. fi
  25. done
  26. ;;
  27. esac
  28. #DEBHELPER#
  29. exit 0