aboutsummaryrefslogtreecommitdiffstats
path: root/community/knot-resolver
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2020-02-23 10:49:30 +0100
committerJakub Jirutka <jakub@jirutka.cz>2020-02-23 14:08:49 +0100
commit1f144a1e6cdcf1fb9eb81f3249fd4f575f31d043 (patch)
tree98d71eefa08ac052606b5baa554a976b0efa5433 /community/knot-resolver
parent58d3aa5473a10c8d175b4b7f24d7f63b3b26a7b0 (diff)
downloadaports-1f144a1e6cdcf1fb9eb81f3249fd4f575f31d043.tar.bz2
aports-1f144a1e6cdcf1fb9eb81f3249fd4f575f31d043.tar.xz
community/knot-resolver: add init script for kres-cache-gc
Diffstat (limited to 'community/knot-resolver')
-rw-r--r--community/knot-resolver/APKBUILD15
-rw-r--r--community/knot-resolver/knot-resolver.confd3
-rw-r--r--community/knot-resolver/kres-cache-gc.confd12
-rw-r--r--community/knot-resolver/kres-cache-gc.initd22
4 files changed, 48 insertions, 4 deletions
diff --git a/community/knot-resolver/APKBUILD b/community/knot-resolver/APKBUILD
index 4c73ffc256..195938b103 100644
--- a/community/knot-resolver/APKBUILD
+++ b/community/knot-resolver/APKBUILD
@@ -3,7 +3,7 @@
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=knot-resolver
pkgver=4.3.0
-pkgrel=3
+pkgrel=4
pkgdesc="Minimalistic caching DNS resolver implementation"
url="https://www.knot-resolver.cz/"
arch="all !s390x" # limited by luajit
@@ -32,6 +32,8 @@ source="https://secure.nic.cz/files/$pkgname/$pkgname-$pkgver.tar.xz
$pkgname.logrotate
$pkgname.confd
$pkgname.initd
+ kres-cache-gc.initd
+ kres-cache-gc.confd
"
builddir="$srcdir/$pkgname-$pkgver"
@@ -76,8 +78,11 @@ package() {
install -m 755 -D "$srcdir"/$pkgname.initd ./etc/init.d/$pkgname
install -m 644 -D "$srcdir"/$pkgname.confd ./etc/conf.d/$pkgname
-
+ install -m 755 -D "$srcdir"/kres-cache-gc.initd ./etc/init.d/kres-cache-gc
+ install -m 644 -D "$srcdir"/kres-cache-gc.confd ./etc/conf.d/kres-cache-gc
install -m 644 -D "$srcdir"/$pkgname.logrotate ./etc/logrotate.d/$pkgname
+
+ install -d -m 750 -o kresd -g kresd ./var/cache/knot-resolver
}
http() {
@@ -109,5 +114,7 @@ gpgfingerprints="
sha512sums="cb59b8bd3d12feeba0fbf45e021c8cd7736393377aa6c71d2d365d0ebb58122c440df3187ed4d3396dacfa5aba4bb752826b9d9da02aea4b626fcba3767c7c47 knot-resolver-4.3.0.tar.xz
688aeacb0c1f21c7e532533b402e67068897217713fb668636df7533000b493981ddfa0497f8dba7da7c804ee4ab8d587a4f52155b4e2bf1f4025d2588d314bb knot-resolver.logrotate
-9a4af28918d85fb973739cc856ac32c07746e4b1b2daee343905d5956bfd6cc45bf5cba87efa56625a9b38aced43aafb793ab37f9a2c06c95a899e47c84ee5a2 knot-resolver.confd
-5891eb694f49ff221233afb0e4d7dcc5879783c3e365732189b623886b3a8351af022d80775bddf25e39f8b930ce9fccaed87384ee793e2746518ec5f3b78324 knot-resolver.initd"
+4e5b75dc1684fb4cd9526caa1c7573366cd092f790503fc6112cead61ebf2cca941c527e42c50063e9c72d377b1e704757acbace6cd7ccd9f4cb4036037938de knot-resolver.confd
+5891eb694f49ff221233afb0e4d7dcc5879783c3e365732189b623886b3a8351af022d80775bddf25e39f8b930ce9fccaed87384ee793e2746518ec5f3b78324 knot-resolver.initd
+569cbe40de039b86ffc55a1633029517cda8bd26fc4e3b267796160c40b0647c2abc0eab8090e95659ce3c143f73e2c997f5c10d5b0f47c73079d622b211d3d7 kres-cache-gc.initd
+be54a2b1e6031262f8aeed050a6e31fe8fea8c937fa5bc0c3b3ff67c7577fa8ba2bfd5a711f6499eb0668522b0b268c707a9fa0035292d0f9c040b96587ffcaf kres-cache-gc.confd"
diff --git a/community/knot-resolver/knot-resolver.confd b/community/knot-resolver/knot-resolver.confd
index 78d9860346..fdf41e07a9 100644
--- a/community/knot-resolver/knot-resolver.confd
+++ b/community/knot-resolver/knot-resolver.confd
@@ -8,3 +8,6 @@
# Path to the logging file.
#logfile="/var/log/knot-resolver.log"
+
+# Uncomment to define soft dependency on kres-cache-gc.
+# rc_want="kres-cache-gc"
diff --git a/community/knot-resolver/kres-cache-gc.confd b/community/knot-resolver/kres-cache-gc.confd
new file mode 100644
index 0000000000..85056accf4
--- /dev/null
+++ b/community/knot-resolver/kres-cache-gc.confd
@@ -0,0 +1,12 @@
+# Configuration for /etc/init.d/kres-cache-gc
+
+# Time interval in milliseconds how often to run GC.
+#garbage_interval=1000
+
+# Path to directory with knot resolver's cache.
+# If not specified, it tries to get it from /etc/conf.d/knot-resolver and if
+# it's not even there, defaults to /var/cache/knot-resolver.
+#cachedir=
+
+# Additional arguments to pass to kres-cache-gc.
+#command_args=
diff --git a/community/knot-resolver/kres-cache-gc.initd b/community/knot-resolver/kres-cache-gc.initd
new file mode 100644
index 0000000000..643186b649
--- /dev/null
+++ b/community/knot-resolver/kres-cache-gc.initd
@@ -0,0 +1,22 @@
+#!/sbin/openrc-run
+
+description="Knot Resolver Cache Garbage Collector"
+
+: ${command_user:="kresd"}
+: ${garbage_interval:=1000}
+: ${output_logger="logger -t kres-cache-gc -p daemon.info"}
+: ${wait:=50} # milliseconds
+
+command="/usr/sbin/kres-cache-gc"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
+start_stop_daemon_args="--wait $wait"
+
+start_pre() {
+ if [ -z "$cachedir" ] && [ -e /etc/conf.d/knot-resolver ]; then
+ cachedir=$(. /etc/conf.d/knot-resolver; echo "$cachedir")
+ fi
+ : ${cachedir:="/var/cache/knot-resolver"}
+
+ command_args="-c $cachedir -d $garbage_interval ${command_args:-}"
+}