Mon Jan 10 00:44:53 2011 UTC ()
Pull up following revision(s) (requested by tron in ticket #1519):
	etc/rc.d/named: revision 1.21
	etc/rc.d/named: revision 1.19
Adjust for new default location of the pid file.
handle new directory structure.


(riz)
diff -r1.18 -r1.18.32.1 src/etc/rc.d/named

cvs diff -r1.18 -r1.18.32.1 src/etc/rc.d/named (expand / switch to unified diff)

--- src/etc/rc.d/named 2005/11/29 21:07:25 1.18
+++ src/etc/rc.d/named 2011/01/10 00:44:53 1.18.32.1
@@ -1,29 +1,29 @@ @@ -1,29 +1,29 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# $NetBSD: named,v 1.18 2005/11/29 21:07:25 christos Exp $ 3# $NetBSD: named,v 1.18.32.1 2011/01/10 00:44:53 riz Exp $
4# 4#
5 5
6# PROVIDE: named 6# PROVIDE: named
7# REQUIRE: SERVERS 7# REQUIRE: SERVERS
8# BEFORE: DAEMON 8# BEFORE: DAEMON
9# KEYWORD: chrootdir 9# KEYWORD: chrootdir
10 10
11$_rc_subr_loaded . /etc/rc.subr 11$_rc_subr_loaded . /etc/rc.subr
12 12
13name="named" 13name="named"
14rcvar=$name 14rcvar=$name
15command="/usr/sbin/${name}" 15command="/usr/sbin/${name}"
16pidfile="/var/run/${name}.pid" 16pidfile="/var/run/${name}/${name}.pid"
17start_precmd="named_precmd" 17start_precmd="named_precmd"
18extra_commands="reload" 18extra_commands="reload"
19required_dirs="$named_chrootdir" # if it is set, it must exist 19required_dirs="$named_chrootdir" # if it is set, it must exist
20 20
21named_migrate() 21named_migrate()
22{ 22{
23 local src=$1 23 local src=$1
24 local dst=$2$1 24 local dst=$2$1
25 echo "Migrating $src to $dst" 25 echo "Migrating $src to $dst"
26( 26(
27 diff=false 27 diff=false
28 cd $src 28 cd $src
29 for f in $(find . -type f) 29 for f in $(find . -type f)
@@ -104,22 +104,27 @@ named_precmd() @@ -104,22 +104,27 @@ named_precmd()
104 then 104 then
105 mv /etc/named.conf ${named_chrootdir}/etc/named.conf 105 mv /etc/named.conf ${named_chrootdir}/etc/named.conf
106 ln -s ${named_chrootdir}/etc/named.conf /etc/named.conf 106 ln -s ${named_chrootdir}/etc/named.conf /etc/named.conf
107 fi 107 fi
108 if [ \( ! -r ${named_chrootdir}/etc/named.conf \) -a \ 108 if [ \( ! -r ${named_chrootdir}/etc/named.conf \) -a \
109 \( -r ${named_chrootdir}/etc/namedb/named.conf \) ]; then 109 \( -r ${named_chrootdir}/etc/namedb/named.conf \) ]; then
110 ln -s namedb/named.conf ${named_chrootdir}/etc 110 ln -s namedb/named.conf ${named_chrootdir}/etc
111 fi 111 fi
112 112
113 if [ -f /etc/localtime ]; then 113 if [ -f /etc/localtime ]; then
114 cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \ 114 cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \
115 cp -p /etc/localtime "${named_chrootdir}/etc/localtime" 115 cp -p /etc/localtime "${named_chrootdir}/etc/localtime"
116 fi 116 fi
117 ln -fs "${named_chrootdir}${pidfile}" ${pidfile} 117
 118 local piddir="$(dirname "${pidfile}")"
 119 mkdir -p "${named_chrootdir}${piddir}" "${piddir}"
 120 chmod 755 "${named_chrootdir}${piddir}" "${piddir}"
 121 chown named:named "${named_chrootdir}${piddir}" "${piddir}"
 122 ln -fs "${named_chrootdir}${pidfile}" "${pidfile}"
118 123
119 # Change run_rc_commands()'s internal copy of $named_flags 124 # Change run_rc_commands()'s internal copy of $named_flags
120 # 125 #
121 rc_flags="-u named -t ${named_chrootdir} $rc_flags" 126 rc_flags="-u named -t ${named_chrootdir} $rc_flags"
122} 127}
123 128
124load_rc_config $name 129load_rc_config $name
125run_rc_command "$1" 130run_rc_command "$1"