debian: fix config permissions, delete debconf support

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>
This commit is contained in:
strawberry 2024-05-13 22:51:32 -04:00 committed by June
parent a063a6d088
commit a8446f910a
4 changed files with 29 additions and 41 deletions

23
debian/config vendored
View file

@ -1,17 +1,18 @@
#!/bin/sh #!/bin/sh
set -e set -e
# TODO: implement debconf support that is maintainable without duplicating the config
# Source debconf library. # Source debconf library.
. /usr/share/debconf/confmodule #. /usr/share/debconf/confmodule
#
# Ask for the Matrix homeserver name, address and port. ## Ask for the Matrix homeserver name, address and port.
db_input high conduwuit/hostname || true #db_input high conduwuit/hostname || true
db_go #db_go
#
db_input low conduwuit/address || true #db_input low conduwuit/address || true
db_go #db_go
#
db_input medium conduwuit/port || true #db_input medium conduwuit/port || true
db_go #db_go
exit 0 exit 0

20
debian/postinst vendored
View file

@ -1,9 +1,12 @@
#!/bin/sh #!/bin/sh
set -e set -e
. /usr/share/debconf/confmodule # TODO: implement debconf support that is maintainable without duplicating the config
#. /usr/share/debconf/confmodule
CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit/ CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit
CONDUWUIT_CONFIG_PATH=/etc/conduwuit
CONDUWUIT_CONFIG_FILE="${CONDUWUIT_CONFIG_PATH}/conduwuit.toml"
case "$1" in case "$1" in
configure) configure)
@ -19,10 +22,15 @@ case "$1" in
fi fi
# Create the database path if it does not exist yet and fix up ownership # Create the database path if it does not exist yet and fix up ownership
# and permissions. # and permissions for the config.
mkdir -p "$CONDUWUIT_DATABASE_PATH" mkdir -v -p "$CONDUWUIT_DATABASE_PATH"
chown conduwuit:conduwuit -R "$CONDUWUIT_DATABASE_PATH"
chmod 700 "$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 esac

6
debian/postrm vendored
View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
set -e set -e
. /usr/share/debconf/confmodule #. /usr/share/debconf/confmodule
CONDUWUIT_CONFIG_PATH=/etc/conduwuit CONDUWUIT_CONFIG_PATH=/etc/conduwuit
CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit CONDUWUIT_DATABASE_PATH=/var/lib/conduwuit
@ -15,11 +15,11 @@ case $1 in
# "configuration files must be preserved when the package is removed, and # "configuration files must be preserved when the package is removed, and
# only deleted when the package is purged." # only deleted when the package is purged."
if [ -d "$CONDUWUIT_CONFIG_PATH" ]; then if [ -d "$CONDUWUIT_CONFIG_PATH" ]; then
rm -r "$CONDUWUIT_CONFIG_PATH" rm -v -r "$CONDUWUIT_CONFIG_PATH"
fi fi
if [ -d "$CONDUWUIT_DATABASE_PATH" ]; then if [ -d "$CONDUWUIT_DATABASE_PATH" ]; then
rm -r "$CONDUWUIT_DATABASE_PATH" rm -v -r "$CONDUWUIT_DATABASE_PATH"
fi fi
;; ;;
esac esac

21
debian/templates vendored
View file

@ -1,21 +0,0 @@
Template: conduwuit/hostname
Type: string
Default: localhost
Description: The server (host)name of the Matrix homeserver
This is the hostname the homeserver will be reachable at via a client.
.
If set to "localhost", you can connect with a client locally and clients
from other hosts and also other homeservers will not be able to reach you!
Template: conduwuit/address
Type: string
Default: 127.0.0.1
Description: The listen address of the Matrix homeserver
This is the address the homeserver will listen on. Leave it set to 127.0.0.1
when using a reverse proxy.
Template: conduwuit/port
Type: string
Default: 6167
Description: The port of the Matrix homeserver
This port is most often just accessed by a reverse proxy.