Gentoo Archives: gentoo-commits

From: "Wolfram Schlich (wschlich)" <wschlich@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-dns/nsd/files: nsd.initd
Date: Wed, 30 Jan 2013 10:43:05
Message-Id: 20130130104302.1DD4D2171E@flycatcher.gentoo.org
1 wschlich 13/01/30 10:43:02
2
3 Added: nsd.initd
4 Log:
5 initial import, ebuild by Tom Hendrikx <tom@×××××××××.net> (see bug #128246)
6
7 (Portage version: 2.2.0_alpha151/cvs/Linux x86_64, unsigned Manifest commit)
8
9 Revision Changes Path
10 1.1 net-dns/nsd/files/nsd.initd
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/nsd/files/nsd.initd?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/nsd/files/nsd.initd?rev=1.1&content-type=text/plain
14
15 Index: nsd.initd
16 ===================================================================
17 #!/sbin/runscript
18 # Copyright 1999-2013 Gentoo Foundation
19 # Distributed under the terms of the GNU General Public License v2
20 # $Header: /var/cvsroot/gentoo-x86/net-dns/nsd/files/nsd.initd,v 1.1 2013/01/30 10:43:02 wschlich Exp $
21
22 description="NSD is an authoritative-only, high performance, open source name server"
23 extra_commands="configtest"
24
25 # these can be overridden in /etc/conf.d/nsd if necessary
26 NSD_CONFIG="${NSD_CONFIG:-/etc/nsd/nsd.conf}"
27 NSD_BINARY="${NSD_BINARY:-/usr/sbin/nsd}"
28 NSD_CHECKCONF="${NSD_CHECKCONF:-/usr/sbin/nsd-checkconf}"
29
30 depend() {
31 need net
32 use logger
33 }
34
35 configtest() {
36 ebegin "Checking ${SVCNAME} configuration"
37 checkconfig
38 eend $?
39 }
40
41 checkconfig() {
42 if ! test -e "${NSD_CONFIG}"; then
43 eerror "You need to create an appropriate config file."
44 eerror "An example can be found in /etc/nsd/nsd.conf.sample"
45 return 1
46 elif ! "${NSD_CHECKCONF}" "${NSD_CONFIG}"; then
47 eerror "You have errors in your configfile (${config_file})"
48 return $?
49 fi
50 return 0
51 }
52
53 start() {
54 ebegin "Starting NSD"
55
56 checkconfig || return $?
57 local pidfile=$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}")
58 checkpath --directory --owner nsd:nsd $(dirname "${pidfile}")
59
60 start-stop-daemon --start --pidfile "${pidfile}" \
61 --exec "${NSD_BINARY}" -- -c "${NSD_CONFIG}"
62 eend $?
63 }
64
65 stop() {
66 ebegin "Stopping NSD"
67
68 checkconfig || return $?
69 local pidfile=$("${NSD_CHECKCONF}" -o pidfile "${NSD_CONFIG}")
70
71 start-stop-daemon --stop --pidfile "${pidfile}"
72 eend $?
73 }