From a8446f910abd6fbdac2b254b1c68e3668a692a81 Mon Sep 17 00:00:00 2001 From: strawberry Date: Mon, 13 May 2024 22:51:32 -0400 Subject: [PATCH] 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 --- debian/config | 23 ++++++++++++----------- debian/postinst | 20 ++++++++++++++------ debian/postrm | 6 +++--- debian/templates | 21 --------------------- 4 files changed, 29 insertions(+), 41 deletions(-) delete mode 100644 debian/templates diff --git a/debian/config b/debian/config index 8e605873..ec84aaa1 100644 --- a/debian/config +++ b/debian/config @@ -1,17 +1,18 @@ #!/bin/sh set -e +# TODO: implement debconf support that is maintainable without duplicating the config # Source debconf library. -. /usr/share/debconf/confmodule - -# Ask for the Matrix homeserver name, address and port. -db_input high conduwuit/hostname || true -db_go - -db_input low conduwuit/address || true -db_go - -db_input medium conduwuit/port || true -db_go +#. /usr/share/debconf/confmodule +# +## Ask for the Matrix homeserver name, address and port. +#db_input high conduwuit/hostname || true +#db_go +# +#db_input low conduwuit/address || true +#db_go +# +#db_input medium conduwuit/port || true +#db_go exit 0 diff --git a/debian/postinst b/debian/postinst index f6e10a97..e2eab94b 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,9 +1,12 @@ #!/bin/sh 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 configure) @@ -19,10 +22,15 @@ case "$1" in fi # Create the database path if it does not exist yet and fix up ownership - # and permissions. - mkdir -p "$CONDUWUIT_DATABASE_PATH" - chown conduwuit:conduwuit -R "$CONDUWUIT_DATABASE_PATH" - chmod 700 "$CONDUWUIT_DATABASE_PATH" + # 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 diff --git a/debian/postrm b/debian/postrm index 1feb6815..d77a885e 100644 --- a/debian/postrm +++ b/debian/postrm @@ -1,7 +1,7 @@ #!/bin/sh set -e -. /usr/share/debconf/confmodule +#. /usr/share/debconf/confmodule CONDUWUIT_CONFIG_PATH=/etc/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 # only deleted when the package is purged." if [ -d "$CONDUWUIT_CONFIG_PATH" ]; then - rm -r "$CONDUWUIT_CONFIG_PATH" + rm -v -r "$CONDUWUIT_CONFIG_PATH" fi if [ -d "$CONDUWUIT_DATABASE_PATH" ]; then - rm -r "$CONDUWUIT_DATABASE_PATH" + rm -v -r "$CONDUWUIT_DATABASE_PATH" fi ;; esac diff --git a/debian/templates b/debian/templates deleted file mode 100644 index 1aa82674..00000000 --- a/debian/templates +++ /dev/null @@ -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.