summaryrefslogtreecommitdiff
path: root/debian/postinst
diff options
context:
space:
mode:
authorPaul van Tilburg <paul@luon.net>2020-05-31 22:49:07 +0200
committerPaul van Tilburg <paul@luon.net>2020-11-24 14:38:15 +0100
commit79692db45dfe2fec6d0fec280bfba2be740d58a5 (patch)
tree450e5e055c578310a0c060c927e8afc4f54bc980 /debian/postinst
parent18f33b1ece291797f22b27e186f93b21a423341c (diff)
downloadconduit-79692db45dfe2fec6d0fec280bfba2be740d58a5.zip
First version of cargo-deb packaging setup
Diffstat (limited to 'debian/postinst')
-rw-r--r--debian/postinst26
1 files changed, 26 insertions, 0 deletions
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 0000000..ee684da
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,26 @@
+#!/bin/sh
+set -e
+
+CONDUIT_DATABASE_PATH=/var/lib/matrix-conduit
+
+case "$1" in
+ configure)
+ # Create the `_matrix-conduit` user if it does not exist yet.
+ if ! getent passwd _matrix-conduit > /dev/null ; then
+ echo 'Adding system user for the Conduit Matrix homeserver' 1>&2
+ adduser --system --group --quiet \
+ --home $CONDUIT_DATABASE_PATH \
+ --disabled-login \
+ --force-badname \
+ _matrix-conduit
+ fi
+
+ # Create the database path if it does not exist yet.
+ if [ ! -d "$CONDUIT_DATABASE_PATH" ]; then
+ mkdir -p "$CONDUIT_DATABASE_PATH"
+ chown _matrix-conduit "$CONDUIT_DATABASE_PATH"
+ fi
+ ;;
+esac
+
+#DEBHELPER#