a8446f910a
debconf support needs to be done in a way that does not duplicate the config file like upstream does. Signed-off-by: strawberry <strawberry@puppygock.gay>
37 lines
1.1 KiB
Bash
37 lines
1.1 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# TODO: implement debconf support that is maintainable without duplicating the config
|
|
#. /usr/share/debconf/confmodule
|
|
|
|
CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit
|
|
CONDUWUIT_CONFIG_PATH=/etc/conduwuit
|
|
CONDUWUIT_CONFIG_FILE="${CONDUWUIT_CONFIG_PATH}/conduwuit.toml"
|
|
|
|
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
|
|
adduser --system --group --quiet \
|
|
--home "$CONDUWUIT_DATABASE_PATH" \
|
|
--disabled-login \
|
|
--shell "/usr/sbin/nologin" \
|
|
--verbose \
|
|
conduwuit
|
|
fi
|
|
|
|
# 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"
|
|
|
|
chown -v conduwuit:conduwuit -R "$CONDUWUIT_DATABASE_PATH"
|
|
chown -v conduwuit:conduwuit -R "$CONDUWUIT_CONFIG_PATH"
|
|
chown -v conduwuit:conduwuit -R "$CONDUWUIT_CONFIG_FILE"
|
|
|
|
chmod -v 740 "$CONDUWUIT_DATABASE_PATH"
|
|
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|