diff options
author | Lars Wendler <polynomial-c@gentoo.org> | 2016-08-24 17:59:18 +0200 |
---|---|---|
committer | Lars Wendler <polynomial-c@gentoo.org> | 2016-08-24 17:59:30 +0200 |
commit | b4926dc5f401a6ff15fc6e4facfffd90bdc25cc9 (patch) | |
tree | 772687a2b73646232d46d32c57037eea65cd6d28 /net-dns/nsd | |
parent | net-dialup/dial: new revision with EAPI=6. (diff) | |
download | gentoo-b4926dc5f401a6ff15fc6e4facfffd90bdc25cc9.tar.gz gentoo-b4926dc5f401a6ff15fc6e4facfffd90bdc25cc9.tar.bz2 gentoo-b4926dc5f401a6ff15fc6e4facfffd90bdc25cc9.zip |
net-dns/nsd: Added partially rewritten init scrip with "reload" target.
Package-Manager: portage-2.3.0
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
Diffstat (limited to 'net-dns/nsd')
-rwxr-xr-x | net-dns/nsd/files/nsd.initd-r1 | 58 | ||||
-rw-r--r-- | net-dns/nsd/nsd-4.1.11.ebuild | 2 |
2 files changed, 59 insertions, 1 deletions
diff --git a/net-dns/nsd/files/nsd.initd-r1 b/net-dns/nsd/files/nsd.initd-r1 new file mode 100755 index 000000000000..3f71e76b1610 --- /dev/null +++ b/net-dns/nsd/files/nsd.initd-r1 @@ -0,0 +1,58 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +description="NSD is an authoritative-only, high performance, open source name server" +extra_commands="configtest" +extra_started_commands="reload" + +# these can be overridden in /etc/conf.d/nsd if necessary +NSD_CONFIG="${NSD_CONFIG:-/etc/nsd/nsd.conf}" +NSD_CHECKCONF="${NSD_CHECKCONF:-/usr/sbin/nsd-checkconf}" +command="${NSD_BINARY:-/usr/sbin/nsd}" +command_args="-c ${NSD_CONFIG}" + +depend() { + need net + use logger +} + +get_pidfile() { + printf '%s' "$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}")" +} + +checkconfig() { + if ! test -e "${NSD_CONFIG}"; then + eerror "You need to create an appropriate config file." + eerror "An example can be found in /etc/nsd/nsd.conf.sample" + return 1 + elif ! "${NSD_CHECKCONF}" "${NSD_CONFIG}"; then + eerror "You have errors in your configfile (${NSD_CONFIG})" + return $? + fi + return 0 +} + +configtest() { + ebegin "Checking ${SVCNAME} configuration" + checkconfig + eend $? +} + +start_pre() { + checkconfig || return $? + checkpath --directory --owner nsd:nsd $(dirname "${pidfile}") + pidfile="$(get_pidfile)" +} + +stop_pre() { + checkconfig || return $? + pidfile="$(get_pidfile)" +} + +reload() { + ebegin "Reloading config and zone files" + kill -s HUP $(cat ${pidfile}) + eend $? +} diff --git a/net-dns/nsd/nsd-4.1.11.ebuild b/net-dns/nsd/nsd-4.1.11.ebuild index 59948d2380f5..3719d0f0ac27 100644 --- a/net-dns/nsd/nsd-4.1.11.ebuild +++ b/net-dns/nsd/nsd-4.1.11.ebuild @@ -67,7 +67,7 @@ src_install() { dodoc doc/{ChangeLog,CREDITS,NSD-4-features,NSD-FOR-BIND-USERS,README,RELNOTES,REQUIREMENTS} - newinitd "${FILESDIR}"/nsd.initd nsd + newinitd "${FILESDIR}"/nsd.initd-r1 nsd # install munin plugin and config if use munin ; then |