fix: Remove unnecessary user and directory modifications

systemd creates a dynamic user for
continuwuity and manages directories for
it automatically, so the debian postinst
script no longer needs to do that.
This commit is contained in:
Ginger 2025-09-02 10:44:47 -04:00 committed by Jade Ellis
commit 0d58e660a2
2 changed files with 2 additions and 32 deletions

24
dist/debian/postinst vendored
View file

@ -9,30 +9,6 @@ CONDUWUIT_CONFIG_PATH=/etc/conduwuit
case "$1" in case "$1" in
configure) 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" \
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"
# 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 ''
echo 'Make sure you edit the example config at /etc/conduwuit/conduwuit.toml before starting!' 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 'To start the server, run: systemctl start conduwuit.service'

10
dist/debian/postrm vendored
View file

@ -20,24 +20,18 @@ case $1 in
if [ -d "$CONDUWUIT_CONFIG_PATH" ]; then if [ -d "$CONDUWUIT_CONFIG_PATH" ]; then
if test -L "$CONDUWUIT_CONFIG_PATH"; then if test -L "$CONDUWUIT_CONFIG_PATH"; then
echo "Deleting conduwuit configuration files" echo "Deleting continuwuity configuration files"
rm -v -r "$CONDUWUIT_CONFIG_PATH" rm -v -r "$CONDUWUIT_CONFIG_PATH"
fi fi
fi fi
if [ -d "$CONDUWUIT_DATABASE_PATH" ]; then if [ -d "$CONDUWUIT_DATABASE_PATH" ]; then
if test -L "$CONDUWUIT_DATABASE_PATH"; then if test -L "$CONDUWUIT_DATABASE_PATH"; then
echo "Deleting conduwuit database directory" echo "Deleting continuwuity database directory"
rm -r "$CONDUWUIT_DATABASE_PATH" rm -r "$CONDUWUIT_DATABASE_PATH"
fi fi
fi fi
if [ -d "$CONDUWUIT_DATABASE_PATH_SYMLINK" ]; then
if test -L "$CONDUWUIT_DATABASE_SYMLINK"; then
echo "Removing matrix-conduit symlink"
rm -r "$CONDUWUIT_DATABASE_PATH_SYMLINK"
fi
fi
;; ;;
esac esac