summaryrefslogtreecommitdiff
path: root/debian/anastasis-httpd.preinst
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-08-30 22:39:52 +0200
committerFlorian Dold <florian@dold.me>2021-08-30 22:39:52 +0200
commitda795d9f4160ef1d39279c07f76481f2c7f7cb20 (patch)
tree7d7cee3312f7cae812f1ba856d59edc0c14f014f /debian/anastasis-httpd.preinst
parent5d2732eb6046d44ee34e837e4bb0a66da9d93c3f (diff)
downloadanastasis-da795d9f4160ef1d39279c07f76481f2c7f7cb20.tar.gz
anastasis-da795d9f4160ef1d39279c07f76481f2c7f7cb20.tar.bz2
anastasis-da795d9f4160ef1d39279c07f76481f2c7f7cb20.zip
debian: preseed debconf in preinst
Diffstat (limited to 'debian/anastasis-httpd.preinst')
-rw-r--r--debian/anastasis-httpd.preinst29
1 files changed, 29 insertions, 0 deletions
diff --git a/debian/anastasis-httpd.preinst b/debian/anastasis-httpd.preinst
new file mode 100644
index 0000000..2d6c261
--- /dev/null
+++ b/debian/anastasis-httpd.preinst
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# We prevent a few questions from being asked
+# upon installation by specifying defaults. Namely,
+# we want the database to be accessed via Unix domain
+# sockets and password-less.
+
+set -e
+
+# When purging this package after the selections in the preinst have been made,
+# the debconf database is left in an inconsistent state and the package cannot
+# be installed again. This happens because dbconf-common will create a
+# template for these questions with a shared owner. Purging will only delete
+# one of the two templates, leading to a DB state where debconf-set-selections
+# fails. We work around this by manually fixing up the debconf database.
+#
+# Unfortunately we can't do this in "postrm", because during "postrm"
+# the configuration database is locked (even after db_stop).
+#
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487300
+if [ -x /usr/share/debconf/fix_db.pl ]; then
+ /usr/share/debconf/fix_db.pl || true
+fi
+
+echo anastasis-httpd anastasis-httpd/pgsql/method select Unix socket | debconf-set-selections
+echo anastasis-httpd anastasis-httpd/pgsql/authmethod-user select ident | debconf-set-selections
+echo anastasis-httpd anastasis-httpd/pgsql/app-pass password | debconf-set-selections
+
+exit 0