diff options
author | Valery Kartel <valery.kartel@gmail.com> | 2015-12-20 18:45:34 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-01-06 14:17:59 +0000 |
commit | 73383796a9ccff86073587470d3f16ecde6a2670 (patch) | |
tree | 9282d88b86f94c400c5fe5e6e25765aeca81a279 /main/nsd/nsd.initd | |
parent | a7cfdfd28f45309a34e2fb359f5d07cf12a98ce2 (diff) | |
download | aports-73383796a9ccff86073587470d3f16ecde6a2670.tar.bz2 aports-73383796a9ccff86073587470d3f16ecde6a2670.tar.xz |
main/nsd: new openrc-run'ed init-script. APKBUILD cleanups
Diffstat (limited to 'main/nsd/nsd.initd')
-rw-r--r-- | main/nsd/nsd.initd | 53 |
1 files changed, 13 insertions, 40 deletions
diff --git a/main/nsd/nsd.initd b/main/nsd/nsd.initd index 6318204f43..9eab285238 100644 --- a/main/nsd/nsd.initd +++ b/main/nsd/nsd.initd @@ -1,51 +1,24 @@ #!/sbin/openrc-run -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-dns/nsd/files/nsd.initd,v 1.2 2013/04/03 19:10:39 wschlich Exp $ -name="NSD" description="NSD is an authoritative-only, high performance, open source name server" -extra_commands="configtest" - -# these can be overridden in /etc/conf.d/nsd if necessary -NSD_CONFIG="${NSD_CONFIG:-/etc/nsd/nsd.conf}" -command="${NSD_BINARY:-/usr/sbin/nsd}" -NSD_CHECKCONF="${NSD_CHECKCONF:-/usr/sbin/nsd-checkconf}" - -command_args="-c ${NSD_CONFIG}" +checkconf=/usr/sbin/nsd-checkconf +cfgfile=${NSD_CONFIG:-/etc/nsd/nsd.conf} +pidfile=$($checkconf -o pidfile $cfgfile) +pidfile=${pidfile:-/var/run/nsd/nsd.pid} +command=/usr/sbin/nsd +command_args="" +required_files="$cfgfile" depend() { need net use logger } -configtest() { - ebegin "Checking ${SVCNAME} configuration" - checkconfig - eend $? -} - -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 -} - start_pre() { - checkconfig || return $? - pidfile=$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}") - checkpath --directory --owner nsd:nsd "${pidfile%/*}" -} - - -stop_pre() { - checkconfig || return $? - pidfile=$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}") + ebegin + checkpath --directory --owner nsd:nsd ${pidfile%/*} + $checkconf $cfgfile + [ "$cfgfile" = "/etc/nsd/nsd.conf" ] || command_args="$command_args -c $cfgfile" + [ "$pidfile" = "/var/run/nsd/nsd.pid" ] || command_args="$command_args -P $pidfile" + eend $? } - |