summaryrefslogtreecommitdiffstats
path: root/debian/knot-resolver.postinst.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 10:41:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 10:41:59 +0000
commitbe05184b2324848b4f33e6e5d9c716bc95f581f3 (patch)
tree4da6fcfe204d1694377e90c44b02f1b0790aabe8 /debian/knot-resolver.postinst.in
parentAdding upstream version 5.3.1. (diff)
downloadknot-resolver-be05184b2324848b4f33e6e5d9c716bc95f581f3.tar.xz
knot-resolver-be05184b2324848b4f33e6e5d9c716bc95f581f3.zip
Adding debian version 5.3.1-1+deb11u1.debian/5.3.1-1+deb11u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/knot-resolver.postinst.in')
-rw-r--r--debian/knot-resolver.postinst.in43
1 files changed, 43 insertions, 0 deletions
diff --git a/debian/knot-resolver.postinst.in b/debian/knot-resolver.postinst.in
new file mode 100644
index 0000000..d403ff4
--- /dev/null
+++ b/debian/knot-resolver.postinst.in
@@ -0,0 +1,43 @@
+#!/bin/sh
+set -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+# In Debian, this should be upgrade from 3-to-5, but the following code
+# and the upgrade-4-to-5.lua file come from upstream. So I keep it like
+# this for uniformity. Also, the issue relies on the lack of support on
+# systemd sockets since 5.x.
+# upgrade-4-to-5
+export UPG_DIR=/var/lib/knot-resolver/.upgrade-4-to-5
+if [ -f ${UPG_DIR}/.unfinished ] ; then
+ rm -f ${UPG_DIR}/.unfinished
+ kresd -c /usr/lib/@DEB_HOST_MULTIARCH@/knot-resolver/upgrade-4-to-5.lua >/dev/null 2>/dev/null
+ db_input high knot-resolver/upgrade-buster-to-bullseye || true
+ db_go || true
+ cat ${UPG_DIR}/kresd.conf.net 2>/dev/null
+fi
+
+if [ "$1" = "configure" ]; then
+ adduser --quiet --system --group --no-create-home --home /var/cache/knot-resolver knot-resolver
+fi
+
+# Restart any running kresd instances if the root key is updated.
+# Note: if knot-resolver upstream watches this file and reloads it
+# upon a change, we can and should remove this trigger.
+if [ "$1" = "triggered" ]; then
+ if [ "$2" = "/usr/share/dns/root.key" ]; then
+ # systemctl of the sub-services is the preferred method to restart
+ deb-systemd-invoke try-restart 'kresd@*.service' || true
+ # but if we are running sysvinit, we can try to restart that process anyway
+ # (kresd.service is masked on systems that use systemd)
+ invoke-rc.d kresd try-restart || true
+ fi
+fi
+
+if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
+ deb-systemd-invoke try-restart 'kresd@*.service' || true
+ invoke-rc.d kresd try-restart || true
+fi
+
+#DEBHELPER#