aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStuart Cardall <developer@it-offshore.co.uk>2017-12-02 13:29:30 +0000
committerJakub Jirutka <jakub@jirutka.cz>2017-12-15 21:43:19 +0100
commitd95feb9192bfd592fea2abe460cb9482655be09f (patch)
tree7dfbf53cd0e56382c2a4c7e84de233857e313e5a
parentd903a94387dd251b043b8b50c57095d0ef498f38 (diff)
downloadaports-d95feb9192bfd592fea2abe460cb9482655be09f.tar.bz2
aports-d95feb9192bfd592fea2abe460cb9482655be09f.tar.xz
main/unbound: add confd and modernize initd
* confd with $command_args (for optional debugging) added * initd format modernized & deprecated variables $SVCNAME changed to $RC_SVCNAME
-rw-r--r--main/unbound/APKBUILD12
-rw-r--r--main/unbound/unbound.confd2
-rw-r--r--main/unbound/unbound.initd48
3 files changed, 28 insertions, 34 deletions
diff --git a/main/unbound/APKBUILD b/main/unbound/APKBUILD
index 5cd49b565e..1a749ef6c6 100644
--- a/main/unbound/APKBUILD
+++ b/main/unbound/APKBUILD
@@ -3,7 +3,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=unbound
pkgver=1.6.7
-pkgrel=1
+pkgrel=2
pkgdesc="Unbound is a validating, recursive, and caching DNS resolver"
pkgusers="unbound"
pkggroups="unbound"
@@ -21,7 +21,9 @@ source="http://unbound.net/downloads/unbound-$pkgver.tar.gz
update-unbound-root-hints
migrate-dnscache-to-unbound
root.hints
- unbound.initd"
+ unbound.initd
+ unbound.confd
+ "
builddir="$srcdir"/$pkgname-$pkgver
build() {
@@ -63,6 +65,9 @@ package() {
install -m755 -D "$srcdir"/unbound.initd \
"$pkgdir"/etc/init.d/unbound
+ install -m644 -D "$srcdir"/unbound.confd \
+ "$pkgdir"/etc/conf.d/unbound
+
install -d -o unbound -g unbound "$pkgdir"/var/run/unbound
install -m644 "$srcdir"/root.hints "$pkgdir"/etc/unbound/
@@ -95,4 +100,5 @@ sha512sums="6e3d1a057081252183343d0d1b8ace742ab15e8f5244e61287340f49289d7449bed9
b16b7b15392c0d560718ee543f1eebc5617085fb30d61cddc20dd948bd8b1634ee5b2de1c9cb172a6c0d1c5bbaf98b6fd39816d39c72a43ff619455449e668ac update-unbound-root-hints
b26a13c1c88da9611a65705dc59f7233c5e0f6aced0d7d66c18536a969a2de627ca5d4bb55eedd81f2f040fa11bde48eaaeca2850f376e72e7a531678a259131 migrate-dnscache-to-unbound
0dca3470ed4ca9b76d6f47f5d20e92924e6648f0870d8594fe6735d8f1cdfeeee7296301066c2a8b2b94f7daed86c15efe00c301ca27e435e5dd2c85508dc9c8 root.hints
-540e7a11fa5421e2d103c42d69faf1ba005adcadfac2f65091795a2f00e5b5acd1436b4d2adfe2bb0fdfcbfb44d0967d6bce87620c618549fcd7e32019040f29 unbound.initd"
+3ca18510ba186a0c7e39eea300b3661f5f64d76a19c9512fa117813ba0ef771316f36ed420ad03ed2350b2bec751444c27aaa172c3e05ff36a06a3a30f7e111d unbound.initd
+9b9fea2a0f2873b737bde482e28693241a21d7e959e775ffdf8c033a7ca7388812b126b210c6ba21c8c958c14f4f6c515a18ce2971c396a528336a37d7a89e3a unbound.confd"
diff --git a/main/unbound/unbound.confd b/main/unbound/unbound.confd
new file mode 100644
index 0000000000..883e10ca33
--- /dev/null
+++ b/main/unbound/unbound.confd
@@ -0,0 +1,2 @@
+# enable debugging (verbose -vv)
+#command_args="-v"
diff --git a/main/unbound/unbound.initd b/main/unbound/unbound.initd
index 9209ec7304..43cf31a6f1 100644
--- a/main/unbound/unbound.initd
+++ b/main/unbound/unbound.initd
@@ -1,7 +1,4 @@
#!/sbin/openrc-run
-# Copyright 1999-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-dns/unbound/files/unbound.initd,v 1.2 2011/09/13 15:14:49 matsuu Exp $
name="unbound daemon"
extra_commands="configtest"
@@ -10,10 +7,13 @@ description="unbound is a Domain Name Server (DNS) that is used to resolve host
description_configtest="Run syntax tests for configuration files only."
description_reload="Kills all children and reloads the configuration."
+# Upper case variables are here only for backward compatibility.
+: ${cfgfile:=${UNBOUND_CONFFILE:-/etc/unbound/$RC_SVCNAME.conf}}
-UNBOUND_BINARY=${UNBOUND_BINARY:-/usr/sbin/unbound}
-UNBOUND_CHECKCONF=${UNBOUND_CHECKCONF:-/usr/sbin/unbound-checkconf}
-UNBOUND_CONFFILE=${UNBOUND_CONFFILE:-/etc/unbound/${SVCNAME}.conf}
+command=/usr/sbin/unbound
+command_args="-d $command_args"
+command_background=yes
+checkconf=/usr/sbin/unbound-checkconf
depend() {
need net
@@ -22,36 +22,22 @@ depend() {
after auth-dns
}
-checkconfig() {
- checkpath --directory /var/run/unbound
- UNBOUND_PIDFILE=$("${UNBOUND_CHECKCONF}" -o pidfile "${UNBOUND_CONFFILE}")
- return $?
-}
-
configtest() {
- ebegin "Checking ${SVCNAME} configuration"
- checkconfig
- eend $?
-}
-
-start() {
- checkconfig || return $?
- ebegin "Starting ${SVCNAME}"
- start-stop-daemon --start --pidfile "${UNBOUND_PIDFILE}" \
- --exec "${UNBOUND_BINARY}" -- -c "${UNBOUND_CONFFILE}"
- eend $?
+ einfo "Checking: $cfgfile" # don't show errors twice
+ pidfile=$($checkconf -o pidfile "$cfgfile" 2>/dev/null)
+ $checkconf -f $cfgfile 1>/dev/null
+ return $?
}
-stop() {
- checkconfig || return $?
- ebegin "Stopping ${SVCNAME}"
- start-stop-daemon --stop --pidfile "${UNBOUND_PIDFILE}"
- eend $?
+start_pre() {
+ configtest || return $?
+ checkpath --directory ${pidfile%/*}
+ einfo "Using pidfile: $pidfile"
}
reload() {
- checkconfig || return $?
- ebegin "Reloading ${SVCNAME}"
- start-stop-daemon --signal HUP --pidfile "${UNBOUND_PIDFILE}"
+ configtest || return $?
+ ebegin "Reloading $name"
+ start-stop-daemon --signal HUP --pidfile "$pidfile"
eend $?
}