summaryrefslogtreecommitdiffstats
path: root/distro/deb/knot-resolver.postinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
commit3d0386f27ca66379acf50199e1d1298386eeeeb8 (patch)
treef87bd4a126b3a843858eb447e8fd5893c3ee3882 /distro/deb/knot-resolver.postinst
parentInitial commit. (diff)
downloadknot-resolver-upstream.tar.xz
knot-resolver-upstream.zip
Adding upstream version 3.2.1.upstream/3.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--distro/deb/knot-resolver.postinst30
1 files changed, 30 insertions, 0 deletions
diff --git a/distro/deb/knot-resolver.postinst b/distro/deb/knot-resolver.postinst
new file mode 100644
index 0000000..7c4bc5b
--- /dev/null
+++ b/distro/deb/knot-resolver.postinst
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+
+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
+ systemctl 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
+ exit 0
+fi
+
+if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
+ if [ -d /run/systemd/system ]; then
+ systemctl try-restart 'kresd@*.service' || true
+ else
+ invoke-rc.d kresd try-restart || true
+ fi
+fi
+
+#DEBHELPER#