1 |
idl0r 11/02/25 12:42:11 |
2 |
|
3 |
Added: named.init-r10 named.confd-r6 |
4 |
Log: |
5 |
Revision bumps. |
6 |
|
7 |
Create /var/bind/dyn by default, writeable by bind itself, bug 354679. |
8 |
Add a CHROOT_NOCHECK option to the init/conf.d script, bug 354375. |
9 |
Add sdb-ldap back in bind 9.7.3-r1, bug 302735. |
10 |
|
11 |
(Portage version: 2.2.0_alpha25/cvs/Linux x86_64) |
12 |
|
13 |
Revision Changes Path |
14 |
1.1 net-dns/bind/files/named.init-r10 |
15 |
|
16 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/files/named.init-r10?rev=1.1&view=markup |
17 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/files/named.init-r10?rev=1.1&content-type=text/plain |
18 |
|
19 |
Index: named.init-r10 |
20 |
=================================================================== |
21 |
#!/sbin/runscript |
22 |
# Copyright 1999-2011 Gentoo Foundation |
23 |
# Distributed under the terms of the GNU General Public License v2 |
24 |
# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r10,v 1.1 2011/02/25 12:42:11 idl0r Exp $ |
25 |
|
26 |
opts="start stop reload restart checkconfig checkzones" |
27 |
|
28 |
depend() { |
29 |
need net |
30 |
use logger |
31 |
provide dns |
32 |
} |
33 |
|
34 |
NAMED_CONF=${CHROOT}/etc/bind/named.conf |
35 |
|
36 |
_mount() { |
37 |
local from |
38 |
local to |
39 |
local opts |
40 |
|
41 |
if [ "${#}" -lt 3 ]; then |
42 |
eerror "_mount(): to few arguments" |
43 |
return 1 |
44 |
fi |
45 |
|
46 |
from=$1 |
47 |
to=$2 |
48 |
shift 2 |
49 |
|
50 |
opts="${*}" |
51 |
shift $# |
52 |
|
53 |
if [ -z "$(awk "\$2 == \"${to}\" { print \$2 }" /proc/mounts)" ]; then |
54 |
einfo "mounting ${from} to ${to}" |
55 |
mount ${from} ${to} ${opts} || return 1 |
56 |
fi |
57 |
|
58 |
return 0 |
59 |
} |
60 |
|
61 |
_umount() { |
62 |
local dir=$1 |
63 |
|
64 |
if [ -n "$(awk "\$2 == \"${dir}\" { print \$2 }" /proc/mounts)" ]; then |
65 |
einfo "umount ${dir}" |
66 |
umount ${dir} || return 1 |
67 |
fi |
68 |
|
69 |
return 0 |
70 |
} |
71 |
|
72 |
_get_pidfile() { |
73 |
# as suggested in bug #107724, bug 335398#c17 |
74 |
[ -n "${PIDFILE}" ] || PIDFILE=${CHROOT}$(\ |
75 |
/usr/sbin/named-checkconf -p ${CHROOT:+-t} ${CHROOT} ${NAMED_CONF/${CHROOT}} | grep 'pid-file' | cut -d\" -f2) |
76 |
[ -z "${PIDFILE}" ] && PIDFILE=${CHROOT}/var/run/named/named.pid |
77 |
} |
78 |
|
79 |
check_chroot() { |
80 |
if [ -n "${CHROOT}" ]; then |
81 |
[ ! -d "${CHROOT}" ] && return 1 |
82 |
[ ! -d "${CHROOT}/dev" ] || [ ! -d "${CHROOT}/etc" ] || [ ! -d "${CHROOT}/var" ] && return 1 |
83 |
[ ! -d "${CHROOT}/var/run" ] || [ ! -d "${CHROOT}/var/log" ] && return 1 |
84 |
[ ! -d "${CHROOT}/etc/bind" ] || [ ! -d "${CHROOT}/var/bind" ] && return 1 |
85 |
[ ! -d "${CHROOT}/var/log/named" ] && return 1 |
86 |
[ ! -e "${CHROOT}/etc/localtime" ] && return 1 |
87 |
[ ! -c "${CHROOT}/dev/null" ] || [ ! -c "${CHROOT}/dev/zero" ] && return 1 |
88 |
[ ! -c "${CHROOT}/dev/random" ] && [ ! -c "${CHROOT}/dev/urandom" ] && return 1 |
89 |
[ "${CHROOT_GEOIP:-0}" -eq 1 ] && [ ! -d "${CHROOT}/usr/share/GeoIP" ] && return 1 |
90 |
fi |
91 |
|
92 |
return 0 |
93 |
} |
94 |
|
95 |
checkconfig() { |
96 |
ebegin "Checking named configuration" |
97 |
|
98 |
if [ ! -f "${NAMED_CONF}" ] ; then |
99 |
eerror "No ${NAMED_CONF} file exists!" |
100 |
return 1 |
101 |
fi |
102 |
|
103 |
/usr/sbin/named-checkconf ${CHROOT:+-t} ${CHROOT} ${NAMED_CONF/${CHROOT}} || { |
104 |
eerror "named-checkconf failed! Please fix your config first." |
105 |
return 1 |
106 |
} |
107 |
|
108 |
eend 0 |
109 |
return 0 |
110 |
} |
111 |
|
112 |
checkzones() { |
113 |
ebegin "Checking named configuration and zones" |
114 |
/usr/sbin/named-checkconf -z -j ${CHROOT:+-t} ${CHROOT} ${NAMED_CONF/${CHROOT}} |
115 |
eend $? |
116 |
} |
117 |
|
118 |
start() { |
119 |
local piddir |
120 |
|
121 |
ebegin "Starting ${CHROOT:+chrooted }named" |
122 |
|
123 |
if [ -n "${CHROOT}" -a "${CHROOT_NOCHECK:-0}" -eq 0 ]; then |
124 |
check_chroot || { |
125 |
eend 1 |
126 |
eerror "Your chroot dir ${CHROOT} is inconsistent, please run 'emerge --config net-dns/bind' first" |
127 |
return 1 |
128 |
} |
129 |
|
130 |
if [ "${CHROOT_NOMOUNT:-0}" -eq 0 ]; then |
131 |
einfo "Mounting chroot dirs" |
132 |
_mount /etc/bind ${CHROOT}/etc/bind -o bind |
133 |
_mount /var/bind ${CHROOT}/var/bind -o bind |
134 |
_mount /var/log/named ${CHROOT}/var/log/named -o bind |
135 |
if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then |
136 |
_mount /usr/share/GeoIP ${CHROOT}/usr/share/GeoIP -o bind |
137 |
fi |
138 |
fi |
139 |
fi |
140 |
|
141 |
checkconfig || { eend 1; return 1; } |
142 |
|
143 |
# create piddir (usually /var/run/named) if necessary, bug 334535 |
144 |
_get_pidfile |
145 |
piddir="${PIDFILE%/*}" |
146 |
if [ ! -d "${piddir}" ]; then |
147 |
checkpath -q -d -o root:named -m 0770 "${piddir}" || { |
148 |
eend 1 |
149 |
return 1 |
150 |
} |
151 |
fi |
152 |
|
153 |
# In case someone have $CPU set in /etc/conf.d/named |
154 |
if [ -n "${CPU}" ] && [ "${CPU}" -gt 0 ]; then |
155 |
CPU="-n ${CPU}" |
156 |
fi |
157 |
|
158 |
start-stop-daemon --start --pidfile ${PIDFILE} \ |
159 |
--nicelevel ${NAMED_NICELEVEL:-0} \ |
160 |
--exec /usr/sbin/named \ |
161 |
-- -u named ${CPU} ${OPTIONS} ${CHROOT:+-t} ${CHROOT} |
162 |
eend $? |
163 |
} |
164 |
|
165 |
stop() { |
166 |
local reported=0 |
167 |
|
168 |
ebegin "Stopping ${CHROOT:+chrooted }named" |
169 |
|
170 |
# Workaround for now, until openrc's restart has been fixed. |
171 |
# openrc doesn't care about a restart() function in init scripts. |
172 |
if [ "${RC_CMD}" = "restart" ]; then |
173 |
checkconfig || { eend 1; return 1; } |
174 |
fi |
175 |
|
176 |
# -R 10, bug 335398 |
177 |
_get_pidfile |
178 |
start-stop-daemon --stop --retry 10 --pidfile $PIDFILE \ |
179 |
--exec /usr/sbin/named |
180 |
|
181 |
if [ -n "${CHROOT}" ] && [ "${CHROOT_NOMOUNT:-0}" -eq 0 ]; then |
182 |
ebegin "Umounting chroot dirs" |
183 |
|
184 |
# just to be sure everything gets clean |
185 |
while fuser -s ${CHROOT} 2>/dev/null; do |
186 |
if [ "${reported}" -eq 0 ]; then |
187 |
einfo "Waiting until all named processes are stopped" |
188 |
reported=1 |
189 |
fi |
190 |
sleep 1 |
191 |
done |
192 |
|
193 |
[ "${CHROOT_GEOIP:-0}" -eq 1 ] && _umount ${CHROOT}/usr/share/GeoIP |
194 |
_umount ${CHROOT}/etc/bind |
195 |
_umount ${CHROOT}/var/log/named |
196 |
_umount ${CHROOT}/var/bind |
197 |
fi |
198 |
|
199 |
eend $? |
200 |
} |
201 |
|
202 |
reload() { |
203 |
local ret |
204 |
|
205 |
ebegin "Reloading named.conf and zone files" |
206 |
|
207 |
checkconfig || { eend 1; return 1; } |
208 |
|
209 |
_get_pidfile |
210 |
if [ -n "${PIDFILE}" ]; then |
211 |
# FIXME: Remove --stop and --oknodo as soon as baselayout-1 has been removed... finally... |
212 |
start-stop-daemon --stop --oknodo --pidfile $PIDFILE --signal HUP --exec /usr/sbin/named |
213 |
ret=$? |
214 |
else |
215 |
ewarn "Unable to determine the pidfile... this is" |
216 |
ewarn "a fallback mode. Please check your installation!" |
217 |
|
218 |
$RC_SERVICE restart |
219 |
ret=$? |
220 |
fi |
221 |
|
222 |
eend $ret |
223 |
} |
224 |
|
225 |
|
226 |
|
227 |
1.1 net-dns/bind/files/named.confd-r6 |
228 |
|
229 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/files/named.confd-r6?rev=1.1&view=markup |
230 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/files/named.confd-r6?rev=1.1&content-type=text/plain |
231 |
|
232 |
Index: named.confd-r6 |
233 |
=================================================================== |
234 |
# Set various named options here. |
235 |
# |
236 |
#OPTIONS="" |
237 |
|
238 |
# Set this to the number of processors you want bind to use. |
239 |
# Leave this unchanged if you want bind to automatically detect the number |
240 |
#CPU="1" |
241 |
|
242 |
# If you wish to run bind in a chroot: |
243 |
# 1) un-comment the CHROOT= assignment, below. You may use |
244 |
# a different chroot directory but MAKE SURE it's empty. |
245 |
# 2) run: emerge --config =<bind-version> |
246 |
# |
247 |
#CHROOT="/chroot/dns" |
248 |
|
249 |
# Uncomment to enable binmount of /usr/share/GeoIP |
250 |
#CHROOT_GEOIP="1" |
251 |
|
252 |
# Uncomment the line below to avoid that the init script mounts the needed paths |
253 |
# into the chroot directory. |
254 |
# You have to copy all needed config files by hand if you say CHROOT_NOMOUNT="1". |
255 |
#CHROOT_NOMOUNT="1" |
256 |
|
257 |
# Uncomment this option if you have setup your own chroot environment and you |
258 |
# don't want/need the chroot consistency check |
259 |
#CHROOT_NOCHECK=1 |
260 |
|
261 |
# Default pid file location |
262 |
PIDFILE="${CHROOT}/var/run/named/named.pid" |
263 |
|
264 |
# Scheduling priority: 19 is the lowest and -20 is the highest. |
265 |
# Default: 0 |
266 |
#NAMED_NICELEVEL="0" |
267 |
|
268 |
# Uncomment rc_named_use/rc_named_after for the database you need. |
269 |
# Its necessary to ensure the database backend will be started before named. |
270 |
|
271 |
# MySQL |
272 |
#rc_named_use="mysql" |
273 |
#rc_named_after="mysql" |
274 |
|
275 |
# PostgreSQL |
276 |
#rc_named_use="pg_autovacuum postgresql" |
277 |
#rc_named_after="pg_autovacuum postgresql" |
278 |
|
279 |
# LDAP |
280 |
#rc_named_use="ldap" |
281 |
#rc_named_after="ldap" |