Files
continuwuity/debian/postinst
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.3 KiB
Bash
Raw Normal View History

2020-05-31 22:49:07 +02:00
#!/bin/sh
set -e
# TODO: implement debconf support that is maintainable without duplicating the config
#. /usr/share/debconf/confmodule
2020-11-13 20:35:22 +01:00
CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit
CONDUWUIT_CONFIG_PATH=/etc/conduwuit
2020-05-31 22:49:07 +02:00
case "$1" in
configure)
# Create the `conduwuit` user if it does not exist yet.
if ! getent passwd conduwuit > /dev/null ; then
echo 'Adding system user for the conduwuit Matrix homeserver' 1>&2
2020-05-31 22:49:07 +02:00
adduser --system --group --quiet \
--home "$CONDUWUIT_DATABASE_PATH" \
2020-05-31 22:49:07 +02:00
--disabled-login \
--shell "/usr/sbin/nologin" \
conduwuit
2020-05-31 22:49:07 +02:00
fi
2023-07-23 12:14:59 +02:00
# Create the database path if it does not exist yet and fix up ownership
# and permissions for the config.
mkdir -v -p "$CONDUWUIT_DATABASE_PATH"
2024-05-28 09:14:30 +02:00
# symlink the previous location for compatibility if it does not exist yet.
if ! test -L "/var/lib/matrix-conduit" ; then
ln -s -v "$CONDUWUIT_DATABASE_PATH" "/var/lib/matrix-conduit"
fi
chown -v conduwuit:conduwuit -R "$CONDUWUIT_DATABASE_PATH"
chown -v conduwuit:conduwuit -R "$CONDUWUIT_CONFIG_PATH"
chmod -v 740 "$CONDUWUIT_DATABASE_PATH"
echo ''
echo 'Make sure you edit the example config at /etc/conduwuit/conduwuit.toml before starting!'
echo 'To start the server, run: systemctl start conduwuit.service'
echo ''
2020-05-31 22:49:07 +02:00
;;
esac
#DEBHELPER#