2020-05-31 20:49:07 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
2020-11-13 19:35:22 +00:00
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
|
2024-04-25 04:09:50 +00:00
|
|
|
CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit/
|
2020-05-31 20:49:07 +00:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
configure)
|
2024-04-25 04:09:50 +00:00
|
|
|
# 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 20:49:07 +00:00
|
|
|
adduser --system --group --quiet \
|
2024-04-25 04:09:50 +00:00
|
|
|
--home "$CONDUWUIT_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 \
|
2024-04-25 04:09:50 +00:00
|
|
|
_conduwuit
|
2020-05-31 20:49:07 +00:00
|
|
|
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.
|
2024-04-25 04:09:50 +00:00
|
|
|
mkdir -p "$CONDUWUIT_DATABASE_PATH"
|
|
|
|
chown _conduwuit:_conduwuit -R "$CONDUWUIT_DATABASE_PATH"
|
|
|
|
chmod 700 "$CONDUWUIT_DATABASE_PATH"
|
2020-05-31 20:49:07 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#DEBHELPER#
|