2020-05-31 20:49:07 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
2024-05-14 02:51:32 +00:00
|
|
|
# TODO: implement debconf support that is maintainable without duplicating the config
|
|
|
|
#. /usr/share/debconf/confmodule
|
2020-11-13 19:35:22 +00:00
|
|
|
|
2024-05-14 02:51:32 +00:00
|
|
|
CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit
|
|
|
|
CONDUWUIT_CONFIG_PATH=/etc/conduwuit
|
|
|
|
CONDUWUIT_CONFIG_FILE="${CONDUWUIT_CONFIG_PATH}/conduwuit.toml"
|
2020-05-31 20:49:07 +00:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
configure)
|
2024-05-09 01:26:05 +00:00
|
|
|
# Create the `conduwuit` user if it does not exist yet.
|
|
|
|
if ! getent passwd conduwuit > /dev/null ; then
|
2024-04-25 04:09:50 +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 \
|
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" \
|
2024-05-14 02:14:24 +00:00
|
|
|
--verbose \
|
2024-05-09 01:26:05 +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
|
2024-05-14 02:51:32 +00:00
|
|
|
# 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"
|
|
|
|
|
2024-05-15 15:45:35 +00:00
|
|
|
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 20:49:07 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#DEBHELPER#
|