2020-05-31 20:49:07 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
2020-11-13 19:35:22 +00:00
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
|
2022-02-13 12:15:40 +00:00
|
|
|
CONDUIT_DATABASE_PATH=/var/lib/matrix-conduit/
|
2020-05-31 20:49:07 +00:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
configure)
|
|
|
|
# Create the `_matrix-conduit` user if it does not exist yet.
|
|
|
|
if ! getent passwd _matrix-conduit > /dev/null ; then
|
2024-03-12 00:15:40 +00:00
|
|
|
echo 'Adding system user for the Conduwuit Matrix homeserver' 1>&2
|
2020-05-31 20:49:07 +00:00
|
|
|
adduser --system --group --quiet \
|
2021-04-16 20:10:52 +00:00
|
|
|
--home "$CONDUIT_DATABASE_PATH" \
|
2020-05-31 20:49:07 +00:00
|
|
|
--disabled-login \
|
2024-03-12 00:15:40 +00:00
|
|
|
--shell "/usr/sbin/nologin" \
|
2020-05-31 20:49:07 +00:00
|
|
|
--force-badname \
|
|
|
|
_matrix-conduit
|
|
|
|
fi
|
|
|
|
|
2023-07-23 10:14:59 +00:00
|
|
|
# Create the database path if it does not exist yet and fix up ownership
|
|
|
|
# and permissions.
|
|
|
|
mkdir -p "$CONDUIT_DATABASE_PATH"
|
2024-03-12 00:15:40 +00:00
|
|
|
chown _matrix-conduit:_matrix-conduit -R "$CONDUIT_DATABASE_PATH"
|
2023-07-23 10:14:59 +00:00
|
|
|
chmod 700 "$CONDUIT_DATABASE_PATH"
|
2020-05-31 20:49:07 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#DEBHELPER#
|