Gentoo Archives: gentoo-commits

From: "Christian Ruppert (idl0r)" <idl0r@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-dns/bind: bind-9.7.3-r1.ebuild bind-9.6.3-r1.ebuild ChangeLog metadata.xml
Date: Fri, 25 Feb 2011 12:42:21
Message-Id: 20110225124211.945652004E@flycatcher.gentoo.org
1 idl0r 11/02/25 12:42:11
2
3 Modified: ChangeLog metadata.xml
4 Added: bind-9.7.3-r1.ebuild bind-9.6.3-r1.ebuild
5 Log:
6 Revision bumps.
7
8 Create /var/bind/dyn by default, writeable by bind itself, bug 354679.
9 Add a CHROOT_NOCHECK option to the init/conf.d script, bug 354375.
10 Add sdb-ldap back in bind 9.7.3-r1, bug 302735.
11
12 (Portage version: 2.2.0_alpha25/cvs/Linux x86_64)
13
14 Revision Changes Path
15 1.318 net-dns/bind/ChangeLog
16
17 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/ChangeLog?rev=1.318&view=markup
18 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/ChangeLog?rev=1.318&content-type=text/plain
19 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/ChangeLog?r1=1.317&r2=1.318
20
21 Index: ChangeLog
22 ===================================================================
23 RCS file: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v
24 retrieving revision 1.317
25 retrieving revision 1.318
26 diff -u -r1.317 -r1.318
27 --- ChangeLog 24 Feb 2011 16:57:29 -0000 1.317
28 +++ ChangeLog 25 Feb 2011 12:42:11 -0000 1.318
29 @@ -1,6 +1,18 @@
30 # ChangeLog for net-dns/bind
31 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
32 -# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v 1.317 2011/02/24 16:57:29 xarthisius Exp $
33 +# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v 1.318 2011/02/25 12:42:11 idl0r Exp $
34 +
35 +*bind-9.7.3-r1 (25 Feb 2011)
36 +*bind-9.6.3-r1 (25 Feb 2011)
37 +
38 + 25 Feb 2011; Christian Ruppert <idl0r@g.o> +bind-9.6.3-r1.ebuild,
39 + +bind-9.7.3-r1.ebuild, +files/named.confd-r6, +files/named.init-r10,
40 + metadata.xml:
41 + Revision bumps.
42 +
43 + Create /var/bind/dyn by default, writeable by bind itself, bug 354679.
44 + Add a CHROOT_NOCHECK option to the init/conf.d script, bug 354375.
45 + Add sdb-ldap back in bind 9.7.3-r1, bug 302735.
46
47 24 Feb 2011; Kacper Kowalik <xarthisius@g.o> bind-9.7.3.ebuild:
48 ppc/ppc64 stable wrt #356223
49
50
51
52 1.12 net-dns/bind/metadata.xml
53
54 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/metadata.xml?rev=1.12&view=markup
55 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/metadata.xml?rev=1.12&content-type=text/plain
56 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/metadata.xml?r1=1.11&r2=1.12
57
58 Index: metadata.xml
59 ===================================================================
60 RCS file: /var/cvsroot/gentoo-x86/net-dns/bind/metadata.xml,v
61 retrieving revision 1.11
62 retrieving revision 1.12
63 diff -u -r1.11 -r1.12
64 --- metadata.xml 23 Feb 2011 20:55:01 -0000 1.11
65 +++ metadata.xml 25 Feb 2011 12:42:11 -0000 1.12
66 @@ -11,7 +11,7 @@
67 <flag name="dlz">Enables dynamic loaded zones, 3rd party extension</flag>
68 <flag name="gssapi">Enable gssapi support</flag>
69 <flag name="resolvconf">Enable support for <pkg>net-dns/openresolv</pkg></flag>
70 -<!-- <flag name="sdb-ldap">Enables ldap-sdb backend</flag> -->
71 + <flag name="sdb-ldap">Enables ldap-sdb backend</flag>
72 <flag name="urandom">Use /dev/urandom instead of /dev/random</flag>
73 </use>
74 </pkgmetadata>
75
76
77
78 1.1 net-dns/bind/bind-9.7.3-r1.ebuild
79
80 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.7.3-r1.ebuild?rev=1.1&view=markup
81 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.7.3-r1.ebuild?rev=1.1&content-type=text/plain
82
83 Index: bind-9.7.3-r1.ebuild
84 ===================================================================
85 # Copyright 1999-2011 Gentoo Foundation
86 # Distributed under the terms of the GNU General Public License v2
87 # $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.7.3-r1.ebuild,v 1.1 2011/02/25 12:42:11 idl0r Exp $
88
89 EAPI="3"
90
91 inherit eutils autotools toolchain-funcs flag-o-matic
92
93 MY_PV="${PV/_p/-P}"
94 MY_P="${PN}-${MY_PV}"
95
96 SDB_LDAP_VER="1.1.0-fc14"
97
98 GEOIP_PV=1.3
99 #GEOIP_PV_AGAINST="${MY_PV}"
100 GEOIP_PV_AGAINST="9.7.2-P2"
101 GEOIP_P="bind-geoip-${GEOIP_PV}"
102 GEOIP_PATCH_A="${GEOIP_P}-${GEOIP_PV_AGAINST}.patch"
103 GEOIP_DOC_A="${GEOIP_P}-readme.txt"
104 GEOIP_SRC_URI_BASE="http://bind-geoip.googlecode.com/"
105
106 DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
107 HOMEPAGE="http://www.isc.org/software/bind"
108 SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
109 doc? ( mirror://gentoo/dyndns-samples.tbz2 )
110 geoip? ( ${GEOIP_SRC_URI_BASE}/files/${GEOIP_DOC_A}
111 ${GEOIP_SRC_URI_BASE}/files/${GEOIP_PATCH_A} )
112 sdb-ldap? ( http://ftp.disconnected-by-peer.at/pub/bind-sdb-ldap-${SDB_LDAP_VER}.patch.bz2 )"
113
114 LICENSE="as-is"
115 SLOT="0"
116 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
117 IUSE="ssl ipv6 doc dlz postgres berkdb mysql odbc ldap selinux idn threads
118 resolvconf urandom xml geoip gssapi sdb-ldap"
119
120 DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
121 mysql? ( >=virtual/mysql-4.0 )
122 odbc? ( >=dev-db/unixODBC-2.2.6 )
123 ldap? ( net-nds/openldap )
124 idn? ( net-dns/idnkit )
125 postgres? ( dev-db/postgresql-base )
126 threads? ( >=sys-libs/libcap-2.1.0 )
127 xml? ( dev-libs/libxml2 )
128 geoip? ( >=dev-libs/geoip-1.4.6 )
129 gssapi? ( virtual/krb5 )
130 sdb-ldap? ( net-nds/openldap )"
131
132 RDEPEND="${DEPEND}
133 selinux? ( sec-policy/selinux-bind )
134 resolvconf? ( net-dns/openresolv )
135 sys-process/psmisc"
136
137 S="${WORKDIR}/${MY_P}"
138
139 pkg_setup() {
140 use threads && {
141 ewarn
142 ewarn "If you're in vserver enviroment, you're probably want to"
143 ewarn "disable threads support because of linux capabilities dependency"
144 ewarn
145 }
146
147 ebegin "Creating named group and user"
148 enewgroup named 40
149 enewuser named 40 -1 /etc/bind named
150 eend ${?}
151 }
152
153 src_prepare() {
154 # Adjusting PATHs in manpages
155 for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
156 sed -i \
157 -e 's:/etc/named.conf:/etc/bind/named.conf:g' \
158 -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
159 -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
160 "${i}" || die "sed failed, ${i} doesn't exist"
161 done
162
163 if use dlz; then
164 # bind fails to reconnect to MySQL5 databases, bug #180720, patch by Nicolas Brousse
165 # (http://www.shell-tips.com/2007/09/04/bind-950-patch-dlz-mysql-5-for-auto-reconnect/)
166 if use mysql && has_version ">=dev-db/mysql-5"; then
167 epatch "${FILESDIR}"/bind-dlzmysql5-reconnect.patch
168 fi
169
170 if use odbc; then
171 epatch "${FILESDIR}/${P}-odbc-dlz-detect.patch"
172 fi
173 fi
174
175 # should be installed by bind-tools
176 sed -i -r -e "s:(nsupdate|dig) ::g" bin/Makefile.in || die
177
178 # sdb-ldap patch as per bug #160567
179 # Upstream URL: http://bind9-ldap.bayour.com/
180 # New patch take from bug 302735
181 if use sdb-ldap; then
182 epatch "${WORKDIR}"/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
183 cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named
184 cp -fp contrib/sdb/ldap/{ldap2zone.1,ldap2zone.c} bin/tools
185 cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/tools
186 fi
187
188 if use geoip; then
189 cp "${DISTDIR}"/${GEOIP_PATCH_A} "${S}" || die
190 sed -i -e 's/RELEASETYPE=-P/RELEASETYPE=/' \
191 -e 's/-RELEASEVER=2/-RELEASEVER=/' \
192 -e 's/+RELEASEVER=2-geoip-1.3/+RELEASEVER=-geoip-1.3/' \
193 ${GEOIP_PATCH_A} || die
194 epatch ${GEOIP_PATCH_A}
195 fi
196
197 # bug #220361
198 rm {aclocal,libtool}.m4
199 WANT_AUTOCONF=2.5 AT_NO_RECURSIVE=1 eautoreconf
200
201 # remove useless c++ checks
202 epunt_cxx
203 }
204
205 src_configure() {
206 local myconf=""
207
208 use dlz && {
209 myconf="${myconf} --with-dlz-filesystem --with-dlz-stub"
210 use postgres && myconf="${myconf} --with-dlz-postgres"
211 use mysql && myconf="${myconf} --with-dlz-mysql"
212 use berkdb && myconf="${myconf} --with-dlz-bdb"
213 use ldap && myconf="${myconf} --with-dlz-ldap"
214 use odbc && myconf="${myconf} --with-dlz-odbc"
215 }
216
217 if use threads; then
218 if use dlz && use mysql; then
219 ewarn
220 ewarn "MySQL uses thread local storage in its C api. Thus MySQL"
221 ewarn "requires that each thread of an application execute a MySQL"
222 ewarn "\"thread initialization\" to setup the thread local storage."
223 ewarn "This is impossible to do safely while staying within the DLZ"
224 ewarn "driver API. This is a limitation caused by MySQL, and not"
225 ewarn "the DLZ API."
226 ewarn "Because of this BIND MUST only run with a single thread when"
227 ewarn "using the MySQL driver."
228 ewarn
229 myconf="${myconf} --disable-linux-caps --disable-threads"
230 ewarn "Threading support disabled"
231 else
232 myconf="${myconf} --enable-linux-caps --enable-threads"
233 einfo "Threading support enabled"
234 fi
235 else
236 myconf="${myconf} --disable-linux-caps --disable-threads"
237 fi
238
239 if use urandom; then
240 myconf="${myconf} --with-randomdev=/dev/urandom"
241 else
242 myconf="${myconf} --with-randomdev=/dev/random"
243 fi
244
245 use geoip && myconf="${myconf} --with-geoip"
246
247 # bug #158664
248 gcc-specs-ssp && replace-flags -O[23s] -O
249
250 export BUILD_CC=$(tc-getBUILD_CC)
251 econf \
252 --sysconfdir=/etc/bind \
253 --localstatedir=/var \
254 --with-libtool \
255 $(use_with ssl openssl) \
256 $(use_with idn) \
257 $(use_enable ipv6) \
258 $(use_with xml libxml2) \
259 $(use_with gssapi) \
260 ${myconf}
261
262 # bug #151839
263 echo '#undef SO_BSDCOMPAT' >> config.h
264 }
265
266 src_install() {
267 emake DESTDIR="${D}" install || die
268
269 dodoc CHANGES FAQ README
270
271 if use idn; then
272 dodoc contrib/idn/README.idnkit || die
273 fi
274
275 if use doc; then
276 dodoc doc/arm/Bv9ARM.pdf || die
277
278 docinto misc
279 dodoc doc/misc/* || die
280
281 # might a 'html' useflag make sense?
282 docinto html
283 dohtml -r doc/arm/* || die
284
285 docinto draft
286 dodoc doc/draft/* || die
287
288 docinto rfc
289 dodoc doc/rfc/* || die
290
291 docinto contrib
292 dodoc contrib/named-bootconf/named-bootconf.sh \
293 contrib/nanny/nanny.pl || die
294
295 # some handy-dandy dynamic dns examples
296 cd "${D}"/usr/share/doc/${PF}
297 tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
298 fi
299
300 use geoip && dodoc "${DISTDIR}"/${GEOIP_P}-readme.txt
301
302 insinto /etc/bind
303 newins "${FILESDIR}"/named.conf-r5 named.conf || die
304
305 # ftp://ftp.rs.internic.net/domain/named.cache:
306 insinto /var/bind
307 doins "${FILESDIR}"/named.cache || die
308
309 insinto /var/bind/pri
310 newins "${FILESDIR}"/127.zone-r1 127.zone || die
311 newins "${FILESDIR}"/localhost.zone-r3 localhost.zone || die
312
313 newinitd "${FILESDIR}"/named.init-r10 named || die
314 newconfd "${FILESDIR}"/named.confd-r6 named || die
315
316 newenvd "${FILESDIR}"/10bind.env 10bind || die
317
318 # Let's get rid of those tools and their manpages since they're provided by bind-tools
319 rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1*
320 rm -f "${D}"/usr/share/man/man8/{dnssec-keygen,nsupdate}.8*
321 rm -f "${D}"/usr/bin/{dig,host,nslookup,dnssec-keygen,nsupdate}
322 rm -f "${D}"/usr/sbin/{dig,host,nslookup,dnssec-keygen,nsupdate}
323
324 dosym /var/bind/named.cache /var/bind/root.cache || die
325 dosym /var/bind/pri /etc/bind/pri || die
326 dosym /var/bind/sec /etc/bind/sec || die
327 dosym /var/bind/dyn /etc/bind/dyn || die
328 keepdir /var/bind/{pri,sec,dyn}
329
330 dodir /var/{run,log}/named || die
331
332 fowners root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}
333 fowners root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
334 fperms 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}
335 fperms 0750 /etc/bind /var/bind/pri
336 fperms 0770 /var/{run,log}/named /var/bind/{,sec,dyn}
337 }
338
339 pkg_postinst() {
340 if [ ! -f '/etc/bind/rndc.key' ]; then
341 if use urandom; then
342 einfo "Using /dev/urandom for generating rndc.key"
343 /usr/sbin/rndc-confgen -r /dev/urandom -a
344 echo
345 else
346 einfo "Using /dev/random for generating rndc.key"
347 /usr/sbin/rndc-confgen -a
348 echo
349 fi
350 chown root:named /etc/bind/rndc.key
351 chmod 0640 /etc/bind/rndc.key
352 fi
353
354 einfo
355 einfo "You can edit /etc/conf.d/named to customize named settings"
356 einfo
357 use mysql || use postgres || use ldap && {
358 elog "If your named depends on MySQL/PostgreSQL or LDAP,"
359 elog "uncomment the specified rc_named_* lines in your"
360 elog "/etc/conf.d/named config to ensure they'll start before bind"
361 einfo
362 }
363 einfo "If you'd like to run bind in a chroot AND this is a new"
364 einfo "install OR your bind doesn't already run in a chroot:"
365 einfo "1) Uncomment and set the CHROOT variable in /etc/conf.d/named."
366 einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`"
367 einfo
368
369 CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT})
370 if [[ -n ${CHROOT} ]]; then
371 elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
372 elog "To enable the old behaviour (without using mount) uncomment the"
373 elog "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
374 elog "If you decide to use the new/default method, ensure to make backup"
375 elog "first and merge your existing configs/zones to /etc/bind and"
376 elog "/var/bind because bind will now mount the needed directories into"
377 elog "the chroot dir."
378 fi
379
380 ewarn
381 ewarn "NOTE: /var/bind/named.ca has been renamed to /var/bind/named.cache"
382 ewarn "you may need to fix your named.conf!"
383 ewarn
384 ewarn "NOTE: If you upgrade from <net-dns/bind-9.4.3_p5-r1, you may encounter permission problems"
385 ewarn "To fix the permissions do:"
386 ewarn "chown root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}"
387 ewarn "chown root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
388 ewarn "chmod 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
389 ewarn "chmod 0750 /etc/bind /var/bind/pri"
390 ewarn "chmod 0770 /var/{run,log}/named /var/bind/{,sec,dyn}"
391 ewarn
392 }
393
394 pkg_config() {
395 CHROOT=$(source /etc/conf.d/named; echo ${CHROOT})
396 CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT})
397 CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP})
398
399 if [[ -z "${CHROOT}" ]]; then
400 eerror "This config script is designed to automate setting up"
401 eerror "a chrooted bind/named. To do so, please first uncomment"
402 eerror "and set the CHROOT variable in '/etc/conf.d/named'."
403 die "Unset CHROOT"
404 fi
405 if [[ -d "${CHROOT}" ]]; then
406 ewarn "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
407 ewarn "To enable the old behaviour (without using mount) uncomment the"
408 ewarn "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
409 ewarn
410 ewarn "${CHROOT} already exists... some things might become overridden"
411 ewarn "press CTRL+C if you don't want to continue"
412 sleep 10
413 fi
414
415 echo; einfo "Setting up the chroot directory..."
416
417 mkdir -m 0750 -p ${CHROOT}
418 mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/{run,log}}
419 mkdir -m 0750 -p ${CHROOT}/etc/bind
420 mkdir -m 0770 -p ${CHROOT}/var/{bind,{run,log}/named}
421 chown root:named ${CHROOT} ${CHROOT}/var/{bind,{run,log}/named} ${CHROOT}/etc/bind
422
423 cp /etc/localtime ${CHROOT}/etc/localtime
424
425 mknod ${CHROOT}/dev/null c 1 3
426 chmod 0666 ${CHROOT}/dev/null
427
428 mknod ${CHROOT}/dev/zero c 1 5
429 chmod 0666 ${CHROOT}/dev/zero
430
431 if use urandom; then
432 mknod ${CHROOT}/dev/urandom c 1 9
433 chmod 0666 ${CHROOT}/dev/urandom
434 else
435 mknod ${CHROOT}/dev/random c 1 8
436 chmod 0666 ${CHROOT}/dev/random
437 fi
438
439 if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
440 cp -a /etc/bind ${CHROOT}/etc/
441 cp -a /var/bind ${CHROOT}/var/
442 fi
443
444 if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
445 mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP
446 fi
447
448 elog "You may need to add the following line to your syslog-ng.conf:"
449 elog "source jail { unix-stream(\"${CHROOT}/dev/log\"); };"
450 }
451
452
453
454 1.1 net-dns/bind/bind-9.6.3-r1.ebuild
455
456 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.6.3-r1.ebuild?rev=1.1&view=markup
457 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-dns/bind/bind-9.6.3-r1.ebuild?rev=1.1&content-type=text/plain
458
459 Index: bind-9.6.3-r1.ebuild
460 ===================================================================
461 # Copyright 1999-2011 Gentoo Foundation
462 # Distributed under the terms of the GNU General Public License v2
463 # $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.6.3-r1.ebuild,v 1.1 2011/02/25 12:42:11 idl0r Exp $
464
465 EAPI="3"
466
467 inherit eutils autotools toolchain-funcs flag-o-matic
468
469 MY_PV="${PV/_p/-P}"
470 MY_P="${PN}-${MY_PV}"
471
472 SDB_LDAP_VER="1.1.0-fc14"
473
474 GEOIP_PV=1.3
475 #GEOIP_PV_AGAINST="${MY_PV}"
476 GEOIP_PV_AGAINST="9.7.2-P2"
477 GEOIP_P="bind-geoip-${GEOIP_PV}"
478 GEOIP_PATCH_A="${GEOIP_P}-${GEOIP_PV_AGAINST}.patch"
479 GEOIP_DOC_A="${GEOIP_P}-readme.txt"
480 GEOIP_SRC_URI_BASE="http://bind-geoip.googlecode.com/"
481
482 DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
483 HOMEPAGE="http://www.isc.org/software/bind"
484 SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
485 doc? ( mirror://gentoo/dyndns-samples.tbz2 )
486 geoip? ( ${GEOIP_SRC_URI_BASE}/files/${GEOIP_DOC_A}
487 ${GEOIP_SRC_URI_BASE}/files/${GEOIP_PATCH_A} )"
488 # sdb-ldap? ( http://ftp.disconnected-by-peer.at/pub/bind-sdb-ldap-${SDB_LDAP_VER}.patch.bz2 )"
489
490 LICENSE="as-is"
491 SLOT="0"
492 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
493 IUSE="ssl ipv6 doc dlz postgres berkdb mysql odbc ldap selinux idn threads
494 resolvconf urandom xml geoip gssapi" # sdb-ldap
495
496 DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
497 mysql? ( >=virtual/mysql-4.0 )
498 odbc? ( >=dev-db/unixODBC-2.2.6 )
499 ldap? ( net-nds/openldap )
500 idn? ( net-dns/idnkit )
501 postgres? ( dev-db/postgresql-base )
502 threads? ( >=sys-libs/libcap-2.1.0 )
503 xml? ( dev-libs/libxml2 )
504 geoip? ( >=dev-libs/geoip-1.4.6 )
505 gssapi? ( virtual/krb5 )"
506 # sdb-ldap? ( net-nds/openldap )
507
508 RDEPEND="${DEPEND}
509 selinux? ( sec-policy/selinux-bind )
510 resolvconf? ( net-dns/openresolv )
511 sys-process/psmisc"
512
513 S="${WORKDIR}/${MY_P}"
514
515 pkg_setup() {
516 use threads && {
517 ewarn
518 ewarn "If you're in vserver enviroment, you're probably want to"
519 ewarn "disable threads support because of linux capabilities dependency"
520 ewarn
521 }
522
523 ebegin "Creating named group and user"
524 enewgroup named 40
525 enewuser named 40 -1 /etc/bind named
526 eend ${?}
527 }
528
529 src_prepare() {
530 # Adjusting PATHs in manpages
531 for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
532 sed -i \
533 -e 's:/etc/named.conf:/etc/bind/named.conf:g' \
534 -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
535 -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
536 "${i}" || die "sed failed, ${i} doesn't exist"
537 done
538
539 if use dlz; then
540 # bind fails to reconnect to MySQL5 databases, bug #180720, patch by Nicolas Brousse
541 # (http://www.shell-tips.com/2007/09/04/bind-950-patch-dlz-mysql-5-for-auto-reconnect/)
542 if use mysql && has_version ">=dev-db/mysql-5"; then
543 epatch "${FILESDIR}"/bind-dlzmysql5-reconnect.patch
544 fi
545
546 if use odbc; then
547 epatch "${FILESDIR}/${PN}-9.7.3-odbc-dlz-detect.patch"
548 fi
549 fi
550
551 # should be installed by bind-tools
552 sed -i -r -e "s:(nsupdate|dig) ::g" bin/Makefile.in || die
553
554 # sdb-ldap patch as per bug #160567
555 # Upstream URL: http://bind9-ldap.bayour.com/
556 # New patch take from bug 302735
557 # if use sdb-ldap; then
558 # epatch "${WORKDIR}"/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
559 # cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named
560 # cp -fp contrib/sdb/ldap/{ldap2zone.1,ldap2zone.c} bin/tools
561 # cp -fp contrib/sdb/ldap/{zone2ldap.1,zone2ldap.c} bin/tools
562 # fi
563
564 if use geoip; then
565 cp "${DISTDIR}"/${GEOIP_PATCH_A} "${S}" || die
566 sed -i -e 's/RELEASETYPE=-P/RELEASETYPE=/' \
567 -e 's/-RELEASEVER=2/-RELEASEVER=/' \
568 -e 's/+RELEASEVER=2-geoip-1.3/+RELEASEVER=-geoip-1.3/' \
569 ${GEOIP_PATCH_A} || die
570 epatch ${GEOIP_PATCH_A}
571 fi
572
573 # bug #220361
574 rm {aclocal,libtool}.m4
575 WANT_AUTOCONF=2.5 AT_NO_RECURSIVE=1 eautoreconf
576
577 # remove useless c++ checks
578 epunt_cxx
579 }
580
581 src_configure() {
582 local myconf=""
583
584 use dlz && {
585 myconf="${myconf} --with-dlz-filesystem --with-dlz-stub"
586 use postgres && myconf="${myconf} --with-dlz-postgres"
587 use mysql && myconf="${myconf} --with-dlz-mysql"
588 use berkdb && myconf="${myconf} --with-dlz-bdb"
589 use ldap && myconf="${myconf} --with-dlz-ldap"
590 use odbc && myconf="${myconf} --with-dlz-odbc"
591 }
592
593 if use threads; then
594 if use dlz && use mysql; then
595 ewarn
596 ewarn "MySQL uses thread local storage in its C api. Thus MySQL"
597 ewarn "requires that each thread of an application execute a MySQL"
598 ewarn "\"thread initialization\" to setup the thread local storage."
599 ewarn "This is impossible to do safely while staying within the DLZ"
600 ewarn "driver API. This is a limitation caused by MySQL, and not"
601 ewarn "the DLZ API."
602 ewarn "Because of this BIND MUST only run with a single thread when"
603 ewarn "using the MySQL driver."
604 ewarn
605 myconf="${myconf} --disable-linux-caps --disable-threads"
606 ewarn "Threading support disabled"
607 else
608 myconf="${myconf} --enable-linux-caps --enable-threads"
609 einfo "Threading support enabled"
610 fi
611 else
612 myconf="${myconf} --disable-linux-caps --disable-threads"
613 fi
614
615 if use urandom; then
616 myconf="${myconf} --with-randomdev=/dev/urandom"
617 else
618 myconf="${myconf} --with-randomdev=/dev/random"
619 fi
620
621 use geoip && myconf="${myconf} --with-geoip"
622
623 # bug #158664
624 gcc-specs-ssp && replace-flags -O[23s] -O
625
626 export BUILD_CC=$(tc-getBUILD_CC)
627 econf \
628 --sysconfdir=/etc/bind \
629 --localstatedir=/var \
630 --with-libtool \
631 $(use_with ssl openssl) \
632 $(use_with idn) \
633 $(use_enable ipv6) \
634 $(use_with xml libxml2) \
635 $(use_with gssapi) \
636 ${myconf}
637
638 # bug #151839
639 echo '#undef SO_BSDCOMPAT' >> config.h
640 }
641
642 src_install() {
643 emake DESTDIR="${D}" install || die
644
645 dodoc CHANGES FAQ KNOWN-DEFECTS README
646
647 if use idn; then
648 dodoc README.idnkit || die
649 fi
650
651 if use doc; then
652 dodoc doc/arm/Bv9ARM.pdf || die
653
654 docinto misc
655 dodoc doc/misc/* || die
656
657 # might a 'html' useflag make sense?
658 docinto html
659 dohtml -r doc/arm/* || die
660
661 docinto draft
662 dodoc doc/draft/* || die
663
664 docinto rfc
665 dodoc doc/rfc/* || die
666
667 docinto contrib
668 dodoc contrib/named-bootconf/named-bootconf.sh \
669 contrib/nanny/nanny.pl || die
670
671 # some handy-dandy dynamic dns examples
672 cd "${D}"/usr/share/doc/${PF}
673 tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
674 fi
675
676 use geoip && dodoc "${DISTDIR}"/${GEOIP_P}-readme.txt
677
678 insinto /etc/bind
679 newins "${FILESDIR}"/named.conf-r5 named.conf || die
680
681 # ftp://ftp.rs.internic.net/domain/named.cache:
682 insinto /var/bind
683 doins "${FILESDIR}"/named.cache || die
684
685 insinto /var/bind/pri
686 newins "${FILESDIR}"/127.zone-r1 127.zone || die
687 newins "${FILESDIR}"/localhost.zone-r3 localhost.zone || die
688
689 newinitd "${FILESDIR}"/named.init-r10 named || die
690 newconfd "${FILESDIR}"/named.confd-r6 named || die
691
692 newenvd "${FILESDIR}"/10bind.env 10bind || die
693
694 # Let's get rid of those tools and their manpages since they're provided by bind-tools
695 rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1*
696 rm -f "${D}"/usr/share/man/man8/{dnssec-keygen,nsupdate}.8*
697 rm -f "${D}"/usr/bin/{dig,host,nslookup,dnssec-keygen,nsupdate}
698 rm -f "${D}"/usr/sbin/{dig,host,nslookup,dnssec-keygen,nsupdate}
699
700 dosym /var/bind/named.cache /var/bind/root.cache || die
701 dosym /var/bind/pri /etc/bind/pri || die
702 dosym /var/bind/sec /etc/bind/sec || die
703 dosym /var/bind/dyn /etc/bind/dyn || die
704 keepdir /var/bind/{pri,sec,dyn}
705
706 dodir /var/{run,log}/named || die
707
708 fowners root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}
709 fowners root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/named.conf
710 fperms 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/named.conf
711 fperms 0750 /etc/bind /var/bind/pri
712 fperms 0770 /var/{run,log}/named /var/bind/{,sec,dyn}
713 }
714
715 pkg_postinst() {
716 if [ ! -f '/etc/bind/rndc.key' ]; then
717 if use urandom; then
718 einfo "Using /dev/urandom for generating rndc.key"
719 /usr/sbin/rndc-confgen -r /dev/urandom -a
720 echo
721 else
722 einfo "Using /dev/random for generating rndc.key"
723 /usr/sbin/rndc-confgen -a
724 echo
725 fi
726 chown root:named /etc/bind/rndc.key
727 chmod 0640 /etc/bind/rndc.key
728 fi
729
730 einfo
731 einfo "You can edit /etc/conf.d/named to customize named settings"
732 einfo
733 use mysql || use postgres || use ldap && {
734 elog "If your named depends on MySQL/PostgreSQL or LDAP,"
735 elog "uncomment the specified rc_named_* lines in your"
736 elog "/etc/conf.d/named config to ensure they'll start before bind"
737 einfo
738 }
739 einfo "If you'd like to run bind in a chroot AND this is a new"
740 einfo "install OR your bind doesn't already run in a chroot:"
741 einfo "1) Uncomment and set the CHROOT variable in /etc/conf.d/named."
742 einfo "2) Run \`emerge --config '=${CATEGORY}/${PF}'\`"
743 einfo
744
745 CHROOT=$(source /etc/conf.d/named 2>/dev/null; echo ${CHROOT})
746 if [[ -n ${CHROOT} ]]; then
747 elog "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
748 elog "To enable the old behaviour (without using mount) uncomment the"
749 elog "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
750 elog "If you decide to use the new/default method, ensure to make backup"
751 elog "first and merge your existing configs/zones to /etc/bind and"
752 elog "/var/bind because bind will now mount the needed directories into"
753 elog "the chroot dir."
754 fi
755
756 ewarn
757 ewarn "NOTE: /var/bind/named.ca has been renamed to /var/bind/named.cache"
758 ewarn "you may need to fix your named.conf!"
759 ewarn
760 ewarn "NOTE: If you upgrade from <net-dns/bind-9.4.3_p5-r1, you may encounter permission problems"
761 ewarn "To fix the permissions do:"
762 ewarn "chown root:named /{etc,var}/bind /var/{run,log}/named /var/bind/{sec,pri,dyn}"
763 ewarn "chown root:named /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
764 ewarn "chmod 0640 /var/bind/named.cache /var/bind/pri/{127,localhost}.zone /etc/bind/{bind.keys,named.conf}"
765 ewarn "chmod 0750 /etc/bind /var/bind/pri"
766 ewarn "chmod 0770 /var/{run,log}/named /var/bind/{,sec,dyn}"
767 ewarn
768 }
769
770 pkg_config() {
771 CHROOT=$(source /etc/conf.d/named; echo ${CHROOT})
772 CHROOT_NOMOUNT=$(source /etc/conf.d/named; echo ${CHROOT_NOMOUNT})
773 CHROOT_GEOIP=$(source /etc/conf.d/named; echo ${CHROOT_GEOIP})
774
775 if [[ -z "${CHROOT}" ]]; then
776 eerror "This config script is designed to automate setting up"
777 eerror "a chrooted bind/named. To do so, please first uncomment"
778 eerror "and set the CHROOT variable in '/etc/conf.d/named'."
779 die "Unset CHROOT"
780 fi
781 if [[ -d "${CHROOT}" ]]; then
782 ewarn "NOTE: As of net-dns/bind-9.4.3_p5-r1 the chroot part of the init-script got some major changes!"
783 ewarn "To enable the old behaviour (without using mount) uncomment the"
784 ewarn "CHROOT_NOMOUNT option in your /etc/conf.d/named config."
785 ewarn
786 ewarn "${CHROOT} already exists... some things might become overridden"
787 ewarn "press CTRL+C if you don't want to continue"
788 sleep 10
789 fi
790
791 echo; einfo "Setting up the chroot directory..."
792
793 mkdir -m 0750 -p ${CHROOT}
794 mkdir -m 0755 -p ${CHROOT}/{dev,etc,var/{run,log}}
795 mkdir -m 0750 -p ${CHROOT}/etc/bind
796 mkdir -m 0770 -p ${CHROOT}/var/{bind,{run,log}/named}
797 chown root:named ${CHROOT} ${CHROOT}/var/{bind,{run,log}/named} ${CHROOT}/etc/bind
798
799 cp /etc/localtime ${CHROOT}/etc/localtime
800
801 mknod ${CHROOT}/dev/null c 1 3
802 chmod 0666 ${CHROOT}/dev/null
803
804 mknod ${CHROOT}/dev/zero c 1 5
805 chmod 0666 ${CHROOT}/dev/zero
806
807 if use urandom; then
808 mknod ${CHROOT}/dev/urandom c 1 9
809 chmod 0666 ${CHROOT}/dev/urandom
810 else
811 mknod ${CHROOT}/dev/random c 1 8
812 chmod 0666 ${CHROOT}/dev/random
813 fi
814
815 if [ "${CHROOT_NOMOUNT:-0}" -ne 0 ]; then
816 cp -a /etc/bind ${CHROOT}/etc/
817 cp -a /var/bind ${CHROOT}/var/
818 fi
819
820 if [ "${CHROOT_GEOIP:-0}" -eq 1 ]; then
821 mkdir -m 0755 -p ${CHROOT}/usr/share/GeoIP
822 fi
823
824 elog "You may need to add the following line to your syslog-ng.conf:"
825 elog "source jail { unix-stream(\"${CHROOT}/dev/log\"); };"
826 }