package-pipelines-miscellan.../mautrix-telegram/debian.postinst

24 lines
727 B
Text
Raw Normal View History

2023-12-05 23:40:22 +01:00
#!/bin/bash
set -e
if [[ "$1" == "configure" ]]; then
if ! getent group mautrix-telegram >/dev/null; then
groupadd --system mautrix-telegram
fi
if ! getent passwd mautrix-telegram >/dev/null; then
useradd --system --gid mautrix-telegram --home-dir /var/lib/mautrix-telegram --shell /bin/bash mautrix-telegram
fi
chown mautrix-telegram:mautrix-telegram /var/lib/mautrix-telegram /var/log/mautrix-telegram
chmod 0750 /var/lib/mautrix-telegram /var/log/mautrix-telegram
chown root:mautrix-telegram /etc/mautrix-telegram.yml
chmod 0640 /etc/mautrix-telegram.yml
deb-systemd-helper enable mautrix-telegram.service
deb-systemd-invoke restart mautrix-telegram.service
fi