diff options
author | Konstantin V. Arkhipov <voxus@gentoo.org> | 2006-10-22 18:05:21 +0000 |
---|---|---|
committer | Konstantin V. Arkhipov <voxus@gentoo.org> | 2006-10-22 18:05:21 +0000 |
commit | e40742311e581894bfe7d0e1319a8f5c6e6d670f (patch) | |
tree | a4e7462a35c6c979eb7de9c87672146e5e89bfdd /net-dns | |
parent | Version bump with minor changes. (diff) | |
download | gentoo-2-e40742311e581894bfe7d0e1319a8f5c6e6d670f.tar.gz gentoo-2-e40742311e581894bfe7d0e1319a8f5c6e6d670f.tar.bz2 gentoo-2-e40742311e581894bfe7d0e1319a8f5c6e6d670f.zip |
+ forgotten init.
(Portage version: 2.1.2_pre3-r6)
Diffstat (limited to 'net-dns')
-rwxr-xr-x | net-dns/bind/files/named.init-r4 | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/net-dns/bind/files/named.init-r4 b/net-dns/bind/files/named.init-r4 new file mode 100755 index 000000000000..7e18d89d8f5e --- /dev/null +++ b/net-dns/bind/files/named.init-r4 @@ -0,0 +1,70 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r4,v 1.1 2006/10/22 18:05:21 voxus Exp $ + +opts="start stop reload restart" + +depend() { + need net + use logger + provide dns +} + +checkconfig() { + if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then + eerror "No ${CHROOT}/etc/bind/named.conf file exists!" + fi + + # In case someone doesn't have $CPU set from /etc/conf.d/named + if [ ! ${CPU} ] ; then + CPU="1" + fi + + # as suggested in bug #107724 + [ -n "${PIDFILE}" ] || PIDFILE=${CHROOT}$(\ + egrep -v \ + "^([[:cntrl:] ]+(#|//|/\*)|(#|//|/\*))" \ + ${CHROOT}/etc/bind/named.conf \ + | egrep -o -m1 "pid\-file +\".+\" *;" \ + | cut -d\" -f2 + ) + + KEY="${CHROOT}/etc/bind/rndc.key" +} + +start() { + ebegin "Starting ${CHROOT:+chrooted }named" + checkconfig || return 1 + start-stop-daemon --start --quiet --pidfile ${PIDFILE} \ + --exec /usr/sbin/named \ + -- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t $CHROOT} + eend $? +} + +stop() { + ebegin "Stopping ${CHROOT:+chrooted }named" + checkconfig || return 2 + if [ -f $KEY ] ; then + rndc -k $KEY stop &>/dev/null + else + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --exec /usr/sbin/named -- stop + fi + eend $? +} + +reload() { + checkconfig || return 3 + if [ ! -f $PIDFILE ] ; then + /etc/init.d/named start &>/dev/null + exit + fi + + if [ -f $KEY ] ; then + ebegin "Reloading named.conf and zone files" + rndc -k $KEY reload &>/dev/null + eend $? + else /etc/init.d/named restart &>/dev/null + fi +} |