Hanno Böck

Hanno Böck commited on 2010-05-10 12:35:50
Zeige 19 geänderte Dateien mit 1025 Einfügungen und 0 Löschungen.

... ...
@@ -0,0 +1,5 @@
1
+AUX bind-tools-9.5.0_p1-lwconfig.patch 1856 RMD160 c14e44da385b69d80e0635f56a3d3a3eda7471d9 SHA1 9297301e6b43d5887b3d40b7a97c1ee6c015cd38 SHA256 5e39cd20da4f2b3bf5ee352d73249c105de1e182c595afb20a15e950f2f88f02
2
+AUX bind-tools-9.6.1-parallel.patch 386 RMD160 a48bdcf7fe020e55c64a692852b6ca71849d6a1c SHA1 cfbf5b9b9bf24cb564eef60716cfa19a89c05c9a SHA256 bc4d39f01190e890590a9841ae682bc68062a1202f67e649a90712ab19f89428
3
+AUX bind-tools-configure.patch 1686 RMD160 4ff8355af81705058fd411910dfae94887bcd884 SHA1 67ae0deff73689cb39cd6e7451262bdda9c25a39 SHA256 dc9386b88eac48c282d63d0be7e7be81d4a0a08035a8b97138a61133e057bcea
4
+DIST bind-9.7.0-P1.tar.gz 7125947 RMD160 200aa067596e09f6f06e8830d0a46f02d324db26 SHA1 6713d65c1455845a9ced6cb4bd705a2575986e42 SHA256 d84b63f71bfc249e5bf1a14ba34af37981b2ee6068d1224066062cfa5d086fcf
5
+EBUILD bind-tools-9.7.0_p1.ebuild 2070 RMD160 921e4474eb7c0d9343eb30f238b1a23f04a7532e SHA1 3de42e1bfea0a65cde8144f6e65c9d267f6a491d SHA256 2c199731199487d764b40e07a3637b509e5b07709e23943ce1d88cac9c880696
... ...
@@ -0,0 +1,91 @@
1
+# Copyright 1999-2010 Gentoo Foundation
2
+# Distributed under the terms of the GNU General Public License v2
3
+# $Header: /var/cvsroot/gentoo-x86/net-dns/bind-tools/bind-tools-9.6.1_p3.ebuild,v 1.1 2010/01/27 18:18:20 jer Exp $
4
+
5
+inherit eutils autotools
6
+
7
+MY_PN=${PN//-tools}
8
+MY_PV=${PV/_p/-P}
9
+MY_P="${MY_PN}-${MY_PV}"
10
+
11
+DESCRIPTION="bind tools: dig, nslookup, host, nsupdate, dnssec-keygen"
12
+HOMEPAGE="http://www.isc.org/software/bind"
13
+SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz"
14
+
15
+LICENSE="as-is"
16
+SLOT="0"
17
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
18
+IUSE="doc idn ipv6 ssl xml"
19
+
20
+DEPEND="ssl? ( dev-libs/openssl )
21
+	xml? ( dev-libs/libxml2 )
22
+	idn? (
23
+		|| ( sys-libs/glibc dev-libs/libiconv )
24
+		net-dns/idnkit
25
+		)"
26
+RDEPEND="${DEPEND}"
27
+
28
+S="${WORKDIR}/${MY_P}"
29
+
30
+src_unpack() {
31
+	unpack ${A}
32
+	cd "${S}"
33
+
34
+	use idn && {
35
+		cd "${S}"/contrib/idn/idnkit-1.0-src
36
+		epatch "${FILESDIR}"/${PN}-configure.patch
37
+		cd -
38
+	}
39
+
40
+	epatch "${FILESDIR}"/${PN}-9.5.0_p1-lwconfig.patch
41
+
42
+	# bug #151839
43
+	sed -i -e \
44
+		's:struct isc_socket {:#undef SO_BSDCOMPAT\n\nstruct isc_socket {:' \
45
+		lib/isc/unix/socket.c || die
46
+
47
+	# bug 278364 (workaround)
48
+	epatch "${FILESDIR}/${PN}-9.6.1-parallel.patch"
49
+
50
+	eautoreconf
51
+}
52
+
53
+src_compile() {
54
+	local myconf=
55
+
56
+	has_version sys-libs/glibc || myconf="${myconf} --with-iconv"
57
+
58
+	econf \
59
+		$(use_enable ipv6) \
60
+		$(use_with idn) \
61
+		$(use_with ssl openssl) \
62
+		$(use_with xml libxml2) \
63
+		${myconf}
64
+
65
+	emake -C lib/ || die "emake lib failed"
66
+	emake -C bin/dig/ || die "emake bin/dig failed"
67
+	emake -C bin/nsupdate/ || die "emake bin/nsupdate failed"
68
+	emake -C bin/dnssec/ || die "emake bin/dnssec failed"
69
+}
70
+
71
+src_install() {
72
+	dodoc README CHANGES FAQ || die
73
+
74
+	cd "${S}"/bin/dig
75
+	dobin dig host nslookup || die
76
+	doman {dig,host,nslookup}.1 || die
77
+
78
+	cd "${S}"/bin/nsupdate
79
+	dobin nsupdate || die
80
+	doman nsupdate.1 || die
81
+	if use doc; then
82
+		dohtml nsupdate.html || die
83
+	fi
84
+
85
+	cd "${S}"/bin/dnssec
86
+	dobin dnssec-keygen || die
87
+	doman dnssec-keygen.8 || die
88
+	if use doc; then
89
+		dohtml dnssec-keygen.html || die
90
+	fi
91
+}
... ...
@@ -0,0 +1,63 @@
1
+--- lib/lwres/lwconfig.c.old	2007-06-20 01:47:22.000000000 +0200
2
++++ lib/lwres/lwconfig.c	2008-06-15 02:57:02.000000000 +0200
3
+@@ -175,13 +175,8 @@
4
+ 	REQUIRE(buffer != NULL);
5
+ 	REQUIRE(size > 0U);
6
+ 
7
+-	*p = '\0';
8
+-
9
+ 	ch = eatwhite(fp);
10
+ 
11
+-	if (ch == EOF)
12
+-		return (EOF);
13
+-
14
+ 	do {
15
+ 		*p = '\0';
16
+ 
17
+@@ -592,23 +587,37 @@
18
+ 		if (strlen(word) == 0U)
19
+ 			rval = LWRES_R_SUCCESS;
20
+ 		else if (strcmp(word, "nameserver") == 0)
21
+-			rval = lwres_conf_parsenameserver(ctx, fp);
22
++			rval = (stopchar != '\n')? /* fail instantly if EOL is reached */
23
++				lwres_conf_parsenameserver(ctx, fp)
24
++				: LWRES_R_FAILURE;
25
+ 		else if (strcmp(word, "lwserver") == 0)
26
+-			rval = lwres_conf_parselwserver(ctx, fp);
27
++			rval = (stopchar != '\n')?
28
++				lwres_conf_parselwserver(ctx, fp)
29
++				: LWRES_R_FAILURE;
30
+ 		else if (strcmp(word, "domain") == 0)
31
+-			rval = lwres_conf_parsedomain(ctx, fp);
32
++			rval = (stopchar != '\n')?
33
++				lwres_conf_parsedomain(ctx, fp)
34
++				: LWRES_R_FAILURE;
35
+ 		else if (strcmp(word, "search") == 0)
36
+-			rval = lwres_conf_parsesearch(ctx, fp);
37
++			rval = (stopchar != '\n')?
38
++				lwres_conf_parsesearch(ctx, fp)
39
++				: LWRES_R_FAILURE;
40
+ 		else if (strcmp(word, "sortlist") == 0)
41
+-			rval = lwres_conf_parsesortlist(ctx, fp);
42
++			rval = (stopchar != '\n')?
43
++				lwres_conf_parsesortlist(ctx, fp)
44
++				: LWRES_R_FAILURE;
45
+ 		else if (strcmp(word, "options") == 0)
46
+-			rval = lwres_conf_parseoption(ctx, fp);
47
++			rval = (stopchar != '\n')?
48
++				lwres_conf_parseoption(ctx, fp)
49
++				: LWRES_R_FAILURE;
50
+ 		else {
51
+ 			/* unrecognised word. Ignore entire line */
52
+ 			rval = LWRES_R_SUCCESS;
53
+-			stopchar = eatline(fp);
54
+-			if (stopchar == EOF) {
55
+-				break;
56
++			if (stopchar != '\n') { /* do not eat the next line */
57
++				stopchar = eatline(fp);
58
++				if (stopchar == EOF) {
59
++					break;
60
++				}
61
+ 			}
62
+ 		}
63
+ 		if (ret == LWRES_R_SUCCESS && rval != LWRES_R_SUCCESS)
... ...
@@ -0,0 +1,13 @@
1
+--- bind-9.6.1/lib/isc/Makefile.in.orig	2009-02-16 02:02:58.000000000 +0100
2
++++ bind-9.6.1/lib/isc/Makefile.in	2009-07-22 01:07:13.000000000 +0200
3
+@@ -80,6 +80,10 @@
4
+ 
5
+ LIBS =		@LIBS@
6
+ 
7
++# Note: the order of SUBDIRS is important.
8
++# Attempt to disable parallel processing.
9
++.NOTPARALLEL:
10
++.NO_PARALLEL:
11
+ SUBDIRS =	include unix nls @ISC_THREAD_DIR@ @ISC_ARCH_DIR@
12
+ TARGETS =	timestamp
13
+ 
... ...
@@ -0,0 +1,41 @@
1
+The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in 
2
+option parsing, it may break.
3
+
4
+http://bugs.gentoo.org/103483
5
+
6
+--- configure
7
++++ configure
8
+@@ -54,6 +54,16 @@
9
+ infodir='${prefix}/info'
10
+ mandir='${prefix}/man'
11
+ 
12
++# NLS nuisances.
13
++# Only set these to C if already set.  These must not be set unconditionally
14
++# because not all systems understand e.g. LANG=C (notably SCO).
15
++# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
16
++# Non-C LC_CTYPE values break the ctype check.
17
++if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
18
++if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
19
++if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
20
++if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
21
++
22
+ # Initialize some other variables.
23
+ subdirs=
24
+ MFLAGS= MAKEFLAGS=
25
+@@ -452,16 +463,6 @@
26
+   esac
27
+ done
28
+ 
29
+-# NLS nuisances.
30
+-# Only set these to C if already set.  These must not be set unconditionally
31
+-# because not all systems understand e.g. LANG=C (notably SCO).
32
+-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
33
+-# Non-C LC_CTYPE values break the ctype check.
34
+-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
35
+-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
36
+-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
37
+-if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
38
+-
39
+ # confdefs.h avoids OS command line length limits that DEFS can exceed.
40
+ rm -rf conftest* confdefs.h
41
+ # AIX cpp loses on an empty file, so make sure it contains at least a newline.
... ...
@@ -0,0 +1,16 @@
1
+AUX 10bind.env 27 RMD160 872245707b4f72a212cda162c59495744d77a6e3 SHA1 7b8c1abd5910bb7a07c6b7c820c2b34a534b2593 SHA256 5ad6a4402372b43809618051873b63646746f400447bba30dc4dfecd028e3650
2
+AUX 127.zone-r1 533 RMD160 2795c6c27912a73ac45582f33de3182382db3a5d SHA1 87fcb2b96db4cef99d25fa87759dd32ea2ac5559 SHA256 0fa4c294640d4191710647d1b18a2099f22ff674b3a35e6e81ff929f921da626
3
+AUX bind-9.4.0-dlzbdb-close_cursor.patch 338 RMD160 3c92206a6c77ac8e9ea854dfc22fda5753b653a9 SHA1 903383e2b142d76a73030c27f2cdab8d100df150 SHA256 4a004d72565d6db683b879851ae8dfaddcf1b39fd0f97a995d9c5d22d72c6395
4
+AUX bind-9.6.1-parallel.patch 386 RMD160 a48bdcf7fe020e55c64a692852b6ca71849d6a1c SHA1 cfbf5b9b9bf24cb564eef60716cfa19a89c05c9a SHA256 bc4d39f01190e890590a9841ae682bc68062a1202f67e649a90712ab19f89428
5
+AUX bind-dlzmysql5-reconnect.patch 1842 RMD160 687f6128b6511dbeecdfc81b197520b1afd74005 SHA1 7b9b8e1b85f1344e4b5d8566ab868fcb1e87a049 SHA256 7376ac37c2d3fbcf5d8e886008639bdbe642f44c9021f435af370bddd3f03bd4
6
+AUX localhost.zone-r3 426 RMD160 b2dfe76923695e6eac49234b7e7f90fef4d1838e SHA1 b84babc535466cacc7001e4c6eb21e22ae11b22d SHA256 3f39e9b5be72435e961cd6f5acdfe396b05640bf370969acf918a939575122bc
7
+AUX named.ca 2940 RMD160 a1a3c1fc88f50c2cd60a3a3dcd2c884f553d1095 SHA1 9feadfe326be6420acab24f262df312d631b1705 SHA256 80bc818ebd61bd2e40f25b1e1999a39dfa8be340ff6ada815a40b5e21ea30c14
8
+AUX named.conf-r3 1314 RMD160 b8189eaac58eb27b612eacc66826802748e145ca SHA1 d8b2af94a89472ed0b767bdebadcfebcbf6ddfd3 SHA256 ab2f7305e9a1d30406528c5ef079beb4970c89572e90d57bb5ddb27b8126ad13
9
+AUX named.confd-r2 479 RMD160 0a0452bf9bb6f18d4628ee72abe82a52d484a2cb SHA1 d0b0e2f5d72d43862c5aaff9a226fd8599992323 SHA256 bae05257852ecbc7f66bd30e452162f15b6f6e8c3fc170fb6dfdfa7d22361915
10
+AUX named.confd-r3 648 RMD160 bb184a1f4d7476e874df37dd0b60638d6da608cb SHA1 21987e0fd4419276efb2d9551d2bde18eece6fb8 SHA256 6daf6f9eddc822eb434dcc651627f3dd8bdfbfa270b1b089724a87dc5fcc559a
11
+AUX named.init-r5 1620 RMD160 37279362e437241188a07e5f274730e68645827e SHA1 00a14819a322b391183084c79cc9a4dc04d0d484 SHA256 07fb9d653f086319680d04abde0218495ed09d3528087257788bf294252a0bad
12
+AUX named.init-r7 2731 RMD160 3c6c7ea44bcf355862fdd1afb3bdbd03a9c95c71 SHA1 3745627a36e0c0cabdc9f632a8a39d7694c1d210 SHA256 3ac9f6f8fef5e29e77eb9520f34472775683dfa0f809ff01b03a50d03fad38d9
13
+DIST bind-9.7.0-P1.tar.gz 7125947 RMD160 200aa067596e09f6f06e8830d0a46f02d324db26 SHA1 6713d65c1455845a9ced6cb4bd705a2575986e42 SHA256 d84b63f71bfc249e5bf1a14ba34af37981b2ee6068d1224066062cfa5d086fcf
14
+DIST bind-sdb-ldap-1.1.0.tar.bz2 5883 RMD160 ec2f684f278e5fa72158486a14dfce3005a62602 SHA1 fae539a29615fda56a2dcb55a1e01d335835b980 SHA256 afe9cc6a99c20f1dc1929b0a30ff815b0aac509a6c12f8df432853c856d35754
15
+DIST dyndns-samples.tbz2 22866 RMD160 27d5b2d0edb8e1ff16b3f980c38d7af33ccf0c7d SHA1 0a62e9458d0e16b67a3a2f63ea485ce969f1fb4d SHA256 92fb06a92ca99cbbe96b90bcca229ef9c12397db57ae17e199dad9f1218fdbe8
16
+EBUILD bind-9.7.0_p1.ebuild 9176 RMD160 7d2a0490fab81405877274bc6667f6a6ebc03376 SHA1 7c9b10542f954d2b72def07ac0c2a4c47a2c6455 SHA256 525711a99c14e5575fefb393e7c08441ce5240f21e9d0449a832871e3e92049e
... ...
@@ -0,0 +1,296 @@
1
+# Copyright 1999-2010 Gentoo Foundation
2
+# Distributed under the terms of the GNU General Public License v2
3
+# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.6.1_p3.ebuild,v 1.1 2010/01/26 18:53:53 idl0r Exp $
4
+
5
+EAPI="2"
6
+
7
+inherit eutils autotools toolchain-funcs flag-o-matic
8
+
9
+MY_PV="${PV/_p/-P}"
10
+MY_P="${PN}-${MY_PV}"
11
+
12
+SDB_LDAP_VER="1.1.0"
13
+
14
+DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
15
+HOMEPAGE="http://www.isc.org/software/bind"
16
+SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
17
+	sdb-ldap? ( mirror://gentoo/bind-sdb-ldap-${SDB_LDAP_VER}.tar.bz2 )
18
+	doc? ( mirror://gentoo/dyndns-samples.tbz2 )"
19
+
20
+LICENSE="as-is"
21
+SLOT="0"
22
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
23
+IUSE="ssl ipv6 doc dlz postgres berkdb mysql odbc ldap selinux idn threads
24
+	resolvconf urandom sdb-ldap xml"
25
+
26
+DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
27
+	mysql? ( >=virtual/mysql-4.0 )
28
+	odbc? ( >=dev-db/unixODBC-2.2.6 )
29
+	ldap? ( net-nds/openldap )
30
+	idn? ( net-dns/idnkit )
31
+	postgres? ( virtual/postgresql-base )
32
+	threads? ( >=sys-libs/libcap-2.1.0 )
33
+	xml? ( dev-libs/libxml2 )"
34
+
35
+RDEPEND="${DEPEND}
36
+	selinux? ( sec-policy/selinux-bind )
37
+	resolvconf? ( net-dns/openresolv )"
38
+
39
+S="${WORKDIR}/${MY_P}"
40
+
41
+pkg_setup() {
42
+	use threads && {
43
+		ewarn
44
+		ewarn "If you're in vserver enviroment, you're probably want to"
45
+		ewarn "disable threads support because of linux capabilities dependency"
46
+		ewarn
47
+	}
48
+
49
+	ebegin "Creating named group and user"
50
+	enewgroup named 40
51
+	enewuser named 40 -1 /etc/bind named
52
+	eend ${?}
53
+}
54
+
55
+src_prepare() {
56
+	# bug 278364 (workaround)
57
+	epatch "${FILESDIR}/${PN}-9.6.1-parallel.patch"
58
+
59
+	# Adjusting PATHs in manpages
60
+	for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
61
+		sed -i \
62
+			-e 's:/etc/named.conf:/etc/bind/named.conf:g' \
63
+			-e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
64
+			-e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
65
+			"${i}" || die "sed failed, ${i} doesn't exist"
66
+	done
67
+
68
+	use dlz && epatch "${FILESDIR}"/${PN}-9.4.0-dlzbdb-close_cursor.patch
69
+
70
+	# bind fails to reconnect to MySQL5 databases, bug #180720, patch by Nicolas Brousse
71
+	# (http://www.shell-tips.com/2007/09/04/bind-950-patch-dlz-mysql-5-for-auto-reconnect/)
72
+	use dlz && use mysql && has_version ">=dev-db/mysql-5" && epatch "${FILESDIR}"/bind-dlzmysql5-reconnect.patch
73
+
74
+	# should be installed by bind-tools
75
+	sed -i -e "s:nsupdate ::g" bin/Makefile.in || die
76
+
77
+	# sdb-ldap patch as per  bug #160567
78
+	# Upstream URL: http://bind9-ldap.bayour.com/
79
+	use sdb-ldap && epatch "${WORKDIR}"/sdb-ldap/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
80
+
81
+	# bug #220361
82
+	rm {aclocal,libtool}.m4
83
+	WANT_AUTOCONF=2.5 AT_NO_RECURSIVE=1 eautoreconf
84
+
85
+	# bug #151839
86
+	sed -i -e \
87
+		's:struct isc_socket {:#undef SO_BSDCOMPAT\n\nstruct isc_socket {:' \
88
+		lib/isc/unix/socket.c || die
89
+
90
+	# remove useless c++ checks
91
+	epunt_cxx
92
+}
93
+
94
+src_configure() {
95
+	local myconf=""
96
+
97
+	use dlz && {
98
+		myconf="${myconf} --with-dlz-filesystem --with-dlz-stub"
99
+		use postgres && myconf="${myconf} --with-dlz-postgres"
100
+		use mysql && myconf="${myconf} --with-dlz-mysql"
101
+		use berkdb && myconf="${myconf} --with-dlz-bdb"
102
+		use ldap  && myconf="${myconf} --with-dlz-ldap"
103
+		use odbc  && myconf="${myconf} --with-dlz-odbc"
104
+	}
105
+
106
+	if use threads; then
107
+		if use dlz && use mysql; then
108
+			ewarn
109
+			ewarn "MySQL uses thread local storage in its C api. Thus MySQL"
110
+			ewarn "requires that each thread of an application execute a MySQL"
111
+			ewarn "\"thread initialization\" to setup the thread local storage."
112
+			ewarn "This is impossible to do safely while staying within the DLZ"
113
+			ewarn "driver API. This is a limitation caused by MySQL, and not"
114
+			ewarn "the DLZ API."
115
+			ewarn "Because of this BIND MUST only run with a single thread when"
116
+			ewarn "using the MySQL driver."
117
+			ewarn
118
+			myconf="${myconf} --disable-linux-caps --disable-threads"
119
+			ewarn "Threading support disabled"
120
+			epause 10
121
+		else
122
+			myconf="${myconf} --enable-linux-caps --enable-threads"
123
+			einfo "Threading support enabled"
124
+		fi
125
+	else
126
+		myconf="${myconf} --disable-linux-caps --disable-threads"
127
+	fi
128
+
129
+	if use urandom; then
130
+		myconf="${myconf} --with-randomdev=/dev/urandom"
131
+	else
132
+		myconf="${myconf} --with-randomdev=/dev/random"
133
+	fi
134
+
135
+	# bug #158664
136
+	gcc-specs-ssp && replace-flags -O[23s] -O
137
+	export BUILD_CC="${CBUILD}-gcc"
138
+	econf \
139
+		--sysconfdir=/etc/bind \
140
+		--localstatedir=/var \
141
+		--with-libtool \
142
+		$(use_with ssl openssl) \
143
+		$(use_with idn) \
144
+		$(use_enable ipv6) \
145
+		$(use_with xml libxml2) \
146
+		${myconf}
147
+}
148
+
149
+src_install() {
150
+	emake DESTDIR="${D}" install || die
151
+
152
+	dodoc CHANGES FAQ README || die
153
+
154
+	if use doc; then
155
+		dodoc doc/arm/Bv9ARM.pdf || die
156
+
157
+		docinto misc
158
+		dodoc doc/misc/* || die
159
+
160
+		# might a 'html' useflag make sense?
161
+		docinto html
162
+		dohtml -r doc/arm/* || die
163
+
164
+		docinto	draft
165
+		dodoc doc/draft/* || die
166
+
167
+		docinto rfc
168
+		dodoc doc/rfc/* || die
169
+
170
+		docinto contrib
171
+		dodoc contrib/named-bootconf/named-bootconf.sh \
172
+			contrib/nanny/nanny.pl || die
173
+
174
+		# some handy-dandy dynamic dns examples
175
+		cd "${D}"/usr/share/doc/${PF}
176
+		tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
177
+	fi
178
+
179
+	newenvd "${FILESDIR}"/10bind.env 10bind || die
180
+
181
+	keepdir /var/bind/sec
182
+
183
+	insinto /etc/bind
184
+	newins "${FILESDIR}"/named.conf-r3 named.conf || die
185
+
186
+	# ftp://ftp.rs.internic.net/domain/named.ca:
187
+	insinto /var/bind
188
+	doins "${FILESDIR}"/named.ca || die
189
+
190
+	insinto /var/bind/pri
191
+	newins "${FILESDIR}"/127.zone-r1 127.zone || die
192
+	newins "${FILESDIR}"/localhost.zone-r3 localhost.zone || die
193
+
194
+	newinitd "${FILESDIR}"/named.init-r7 named || die
195
+	newconfd "${FILESDIR}"/named.confd-r3 named || die
196
+
197
+	dosym /var/bind/named.ca /var/bind/root.cache
198
+	dosym /var/bind/pri /etc/bind/pri
199
+	dosym /var/bind/sec /etc/bind/sec
200
+
201
+	# Let's get rid of those tools and their manpages since they're provided by bind-tools
202
+	rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1*
203
+	rm -f "${D}"/usr/share/man/man8/{dnssec-keygen,nsupdate}.8*
204
+	rm -f "${D}"/usr/bin/{dig,host,nslookup,dnssec-keygen,nsupdate}
205
+	rm -f "${D}"/usr/sbin/{dig,host,nslookup,dnssec-keygen,nsupdate}
206
+}
207
+
208
+pkg_postinst() {
209
+	if [ ! -f '/etc/bind/rndc.key' ]; then
210
+		if [ -c /dev/urandom ]; then
211
+			einfo "Using /dev/urandom for generating rndc.key"
212
+			/usr/sbin/rndc-confgen -r /dev/urandom -a -u named
213
+			echo
214
+		else
215
+			einfo "Using /dev/random for generating rndc.key"
216
+			/usr/sbin/rndc-confgen -a -u named
217
+			echo
218
+		fi
219
+	fi
220
+
221
+	install -d -o named -g named "${ROOT}"/var/run/named \
222
+		"${ROOT}"/var/bind/{pri,sec} "${ROOT}"/var/log/named
223
+	chown -R named:named "${ROOT}"/var/bind
224
+
225
+	einfo "The default zone files are now installed as *.zone,"
226
+	einfo "be careful merging config files if you have modified"
227
+	einfo "/var/bind/pri/127 or /var/bind/pri/localhost"
228
+	einfo
229
+	einfo "You can edit /etc/conf.d/named to customize named settings"
230
+	einfo
231
+	einfo "The BIND ebuild now includes chroot support."
232
+	einfo "If you like to run bind in chroot AND this is a new install OR"
233
+	einfo "your bind doesn't already run in chroot, simply run:"
234
+	einfo "\`emerge --config '=${CATEGORY}/${PF}'\`"
235
+	einfo "Before running the above command you might want to change the chroot"
236
+	einfo "dir in /etc/conf.d/named. Otherwise /chroot/dns will be used."
237
+	einfo
238
+	einfo "Recently verisign added a wildcard A record to the .COM and .NET TLD"
239
+	einfo "zones making all .com and .net domains appear to be registered"
240
+	einfo "This causes many problems such as breaking important anti-spam checks"
241
+	einfo "which verify source domains exist. ISC released a patch for BIND which"
242
+	einfo "adds 'delegation-only' zones to allow admins to return the .com and .net"
243
+	einfo "domain resolution to their normal function."
244
+	einfo
245
+	einfo "There is no need to create a com or net data file. Just the"
246
+	einfo "entries to the named.conf file is enough."
247
+	einfo
248
+	einfo "	zone "com" IN { type delegation-only; };"
249
+	einfo "	zone "net" IN { type delegation-only; };"
250
+
251
+	ewarn "NOTE: as of 'bind-9.6.1' the chroot part of the init-script got some major changes."
252
+}
253
+
254
+pkg_config() {
255
+	CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/named 2>/dev/null`
256
+	EXISTS="no"
257
+
258
+	if [ -z "${CHROOT}" -a ! -d "/chroot/dns" ]; then
259
+		CHROOT="/chroot/dns"
260
+	elif [ -d ${CHROOT} ]; then
261
+		eerror; eerror "${CHROOT:-/chroot/dns} already exists. Quitting."; eerror; EXISTS="yes"
262
+	fi
263
+
264
+	if [ ! "$EXISTS" = yes ]; then
265
+		einfo ; einfon "Setting up the chroot directory..."
266
+
267
+		mkdir -m 750 -p ${CHROOT}
268
+		mkdir -p ${CHROOT}/{dev,proc,etc/bind,var/{run,log}/named,var/bind}
269
+		chown -R named:named ${CHROOT}
270
+		chown root:named ${CHROOT}
271
+
272
+		cp /etc/localtime ${CHROOT}/etc/localtime
273
+
274
+		mknod ${CHROOT}/dev/zero c 1 5
275
+		chmod 666 ${CHROOT}/dev/zero
276
+
277
+		if use urandom; then
278
+			mknod ${CHROOT}/dev/urandom c 1 9
279
+			chmod 666 ${CHROOT}/dev/urandom
280
+		else
281
+			mknod ${CHROOT}/dev/random c 1 8
282
+			chmod 666 ${CHROOT}/dev/random
283
+		fi
284
+
285
+		if [ -f '/etc/syslog-ng/syslog-ng.conf' ]; then
286
+			echo "source jail { unix-stream(\"${CHROOT}/dev/log\"); };" >>/etc/syslog-ng/syslog-ng.conf
287
+		fi
288
+
289
+		grep -q "^#[[:blank:]]\?CHROOT" /etc/conf.d/named ; RETVAL=$?
290
+		if [ $RETVAL = 0 ]; then
291
+			sed -i 's/^# \?\(CHROOT.*\)$/\1/' /etc/conf.d/named 2>/dev/null
292
+		fi
293
+	else
294
+		ewarn "NOTE: as of 'bind-9.6.1' the chroot part of the init-script got some major changes."
295
+	fi
296
+}
... ...
@@ -0,0 +1 @@
1
+CONFIG_PROTECT="/var/bind"
... ...
@@ -0,0 +1,12 @@
1
+$ORIGIN 127.in-addr.arpa.
2
+$TTL 1W
3
+@                       1D IN SOA       localhost. root.localhost. (
4
+                                        2008122601      ; serial
5
+                                        3H              ; refresh
6
+                                        15M             ; retry
7
+                                        1W              ; expiry
8
+                                        1D )            ; minimum
9
+
10
+@                       1D IN NS        localhost.
11
+1.0.0                   1D IN PTR       localhost.
12
+
... ...
@@ -0,0 +1,11 @@
1
+--- contrib/dlz/drivers/dlz_bdbhpt_driver.c	2007-03-02 12:02:12.000000000 +0300
2
++++ contrib/dlz/drivers/dlz_bdbhpt_driver.c	2007-03-02 12:02:18.000000000 +0300
3
+@@ -442,7 +442,7 @@
4
+ 		xfr_cursor->c_close(xfr_cursor);
5
+ 
6
+ 	if (dns_cursor != NULL)
7
+-		dns_cursor->c_close(xfr_cursor);
8
++		dns_cursor->c_close(dns_cursor);
9
+ 
10
+ 	return result;
11
+ }
... ...
@@ -0,0 +1,13 @@
1
+--- bind-9.6.1/lib/isc/Makefile.in.orig	2009-02-16 02:02:58.000000000 +0100
2
++++ bind-9.6.1/lib/isc/Makefile.in	2009-07-22 01:07:13.000000000 +0200
3
+@@ -80,6 +80,10 @@
4
+ 
5
+ LIBS =		@LIBS@
6
+ 
7
++# Note: the order of SUBDIRS is important.
8
++# Attempt to disable parallel processing.
9
++.NOTPARALLEL:
10
++.NO_PARALLEL:
11
+ SUBDIRS =	include unix nls @ISC_THREAD_DIR@ @ISC_ARCH_DIR@
12
+ TARGETS =	timestamp
13
+ 
... ...
@@ -0,0 +1,59 @@
1
+--- bind-9.5.0a6.orig/contrib/dlz/drivers/dlz_mysql_driver.c	2007-02-06 06:44:26.000000000 +0100
2
++++ bind-9.5.0a6/contrib/dlz/drivers/dlz_mysql_driver.c	2007-09-04 23:57:57.000000000 +0200
3
+@@ -92,6 +92,25 @@
4
+  */
5
+ 
6
+ /*%
7
++ * Factorize the mysql_ping for adding a log error message
8
++ */
9
++static isc_result_t
10
++mysqldrv_ping(dbinstance_t *dbi) {
11
++    int pres = 0;
12
++
13
++    pres = mysql_ping(dbi->dbconn);
14
++    if ( pres != 0 ) {
15
++        isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
16
++                      DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
17
++                      "\nMySQL Ping Error : %s (%i)\n",
18
++                      mysql_error(dbi->dbconn),
19
++                      mysql_errno(dbi->dbconn));
20
++        return (ISC_R_FAILURE);
21
++    }
22
++    return (ISC_R_SUCCESS);
23
++}
24
++
25
++/*%
26
+  * Allocates memory for a new string, and then constructs the new
27
+  * string by "escaping" the input string.  The new string is
28
+  * safe to be used in queries.  This is necessary because we cannot
29
+@@ -225,6 +244,8 @@
30
+ 	}
31
+ 
32
+ 
33
++    mysqldrv_ping(dbi);
34
++
35
+ 	/*
36
+ 	 * was a zone string passed?  If so, make it safe for use in
37
+ 	 * queries.
38
+@@ -324,7 +345,7 @@
39
+ 		qres = mysql_query((MYSQL *) dbi->dbconn, querystring);
40
+ 		if (qres == 0)
41
+ 			break;
42
+-		for (j=0; mysql_ping((MYSQL *) dbi->dbconn) != 0 && j < 4; j++)
43
++		for (j=0; mysqldrv_ping(dbi) != 0 && j < 4; j++)
44
+ 			;
45
+ 	}
46
+ 
47
+@@ -923,6 +944,12 @@
48
+ 	pass = getParameterValue(argv[1], "pass=");
49
+ 	socket = getParameterValue(argv[1], "socket=");
50
+ 
51
++    if(mysql_options((MYSQL *) dbi->dbconn, MYSQL_OPT_RECONNECT, "1")) {
52
++		isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
53
++			      DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
54
++			      "Could not set database reconnect option");
55
++    }
56
++
57
+ 	for (j=0; dbc == NULL && j < 4; j++)
58
+ 		dbc = mysql_real_connect((MYSQL *) dbi->dbconn, host,
59
+ 					 user, pass, dbname, port, socket,
... ...
@@ -0,0 +1,11 @@
1
+$TTL 1W
2
+@       IN      SOA     localhost. root.localhost.  (
3
+                                      2008122601 ; Serial
4
+                                      28800      ; Refresh
5
+                                      14400      ; Retry
6
+                                      604800     ; Expire - 1 week
7
+                                      86400 )    ; Minimum
8
+@		IN      NS      localhost.
9
+@		IN	A	127.0.0.1
10
+
11
+@		IN	AAAA	::1
... ...
@@ -0,0 +1,86 @@
1
+;       This file holds the information on root name servers needed to
2
+;       initialize cache of Internet domain name servers
3
+;       (e.g. reference this file in the "cache  .  <file>"
4
+;       configuration file of BIND domain name servers).
5
+;
6
+;       This file is made available by InterNIC 
7
+;       under anonymous FTP as
8
+;           file                /domain/named.root
9
+;           on server           FTP.INTERNIC.NET
10
+;       -OR-                    RS.INTERNIC.NET
11
+;
12
+;       last update:    Dec 12, 2008
13
+;       related version of root zone:   2008121200
14
+;
15
+; formerly NS.INTERNIC.NET
16
+;
17
+.                        3600000  IN  NS    A.ROOT-SERVERS.NET.
18
+A.ROOT-SERVERS.NET.      3600000      A     198.41.0.4
19
+A.ROOT-SERVERS.NET.      3600000      AAAA  2001:503:BA3E::2:30
20
+;
21
+; FORMERLY NS1.ISI.EDU
22
+;
23
+.                        3600000      NS    B.ROOT-SERVERS.NET.
24
+B.ROOT-SERVERS.NET.      3600000      A     192.228.79.201
25
+;
26
+; FORMERLY C.PSI.NET
27
+;
28
+.                        3600000      NS    C.ROOT-SERVERS.NET.
29
+C.ROOT-SERVERS.NET.      3600000      A     192.33.4.12
30
+;
31
+; FORMERLY TERP.UMD.EDU
32
+;
33
+.                        3600000      NS    D.ROOT-SERVERS.NET.
34
+D.ROOT-SERVERS.NET.      3600000      A     128.8.10.90
35
+;
36
+; FORMERLY NS.NASA.GOV
37
+;
38
+.                        3600000      NS    E.ROOT-SERVERS.NET.
39
+E.ROOT-SERVERS.NET.      3600000      A     192.203.230.10
40
+;
41
+; FORMERLY NS.ISC.ORG
42
+;
43
+.                        3600000      NS    F.ROOT-SERVERS.NET.
44
+F.ROOT-SERVERS.NET.      3600000      A     192.5.5.241
45
+F.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:2F::F
46
+;
47
+; FORMERLY NS.NIC.DDN.MIL
48
+;
49
+.                        3600000      NS    G.ROOT-SERVERS.NET.
50
+G.ROOT-SERVERS.NET.      3600000      A     192.112.36.4
51
+;
52
+; FORMERLY AOS.ARL.ARMY.MIL
53
+;
54
+.                        3600000      NS    H.ROOT-SERVERS.NET.
55
+H.ROOT-SERVERS.NET.      3600000      A     128.63.2.53
56
+H.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:1::803F:235
57
+;
58
+; FORMERLY NIC.NORDU.NET
59
+;
60
+.                        3600000      NS    I.ROOT-SERVERS.NET.
61
+I.ROOT-SERVERS.NET.      3600000      A     192.36.148.17
62
+;
63
+; OPERATED BY VERISIGN, INC.
64
+;
65
+.                        3600000      NS    J.ROOT-SERVERS.NET.
66
+J.ROOT-SERVERS.NET.      3600000      A     192.58.128.30
67
+J.ROOT-SERVERS.NET.      3600000      AAAA  2001:503:C27::2:30
68
+;
69
+; OPERATED BY RIPE NCC
70
+;
71
+.                        3600000      NS    K.ROOT-SERVERS.NET.
72
+K.ROOT-SERVERS.NET.      3600000      A     193.0.14.129 
73
+K.ROOT-SERVERS.NET.      3600000      AAAA  2001:7FD::1
74
+;
75
+; OPERATED BY ICANN
76
+;
77
+.                        3600000      NS    L.ROOT-SERVERS.NET.
78
+L.ROOT-SERVERS.NET.      3600000      A     199.7.83.42
79
+L.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:3::42   
80
+;
81
+; OPERATED BY WIDE
82
+;
83
+.                        3600000      NS    M.ROOT-SERVERS.NET.
84
+M.ROOT-SERVERS.NET.      3600000      A     202.12.27.33
85
+M.ROOT-SERVERS.NET.      3600000      AAAA  2001:DC3::35
86
+; End of File
... ...
@@ -0,0 +1,53 @@
1
+options {
2
+	directory "/var/bind";
3
+
4
+	// uncomment the following lines to turn on DNS forwarding,
5
+	// and change the forwarding ip address(es) :
6
+	//forward first;
7
+	//forwarders {
8
+	//	123.123.123.123;
9
+	//	123.123.123.123;
10
+	//};
11
+
12
+	listen-on-v6 { none; };
13
+        listen-on { 127.0.0.1; };
14
+
15
+	// to allow only specific hosts to use the DNS server:
16
+	//allow-query {
17
+	//	127.0.0.1;
18
+	//};
19
+
20
+	// if you have problems and are behind a firewall:
21
+	//query-source address * port 53;
22
+	pid-file "/var/run/named/named.pid";
23
+};
24
+
25
+// Briefly, a zone which has been declared delegation-only will be effectively
26
+// limited to containing NS RRs for subdomains, but no actual data beyond its
27
+// own apex (for example, its SOA RR and apex NS RRset). This can be used to
28
+// filter out "wildcard" or "synthesized" data from NAT boxes or from
29
+// authoritative name servers whose undelegated (in-zone) data is of no
30
+// interest.
31
+// See http://www.isc.org/products/BIND/delegation-only.html for more info
32
+
33
+//zone "COM" { type delegation-only; };
34
+//zone "NET" { type delegation-only; };
35
+
36
+zone "." IN {
37
+	type hint;
38
+	file "named.ca";
39
+};
40
+
41
+zone "localhost" IN {
42
+	type master;
43
+	file "pri/localhost.zone";
44
+	allow-update { none; };
45
+	notify no;
46
+};
47
+
48
+zone "127.in-addr.arpa" IN {
49
+	type master;
50
+	file "pri/127.zone";
51
+	allow-update { none; };
52
+	notify no;
53
+};
... ...
@@ -0,0 +1,20 @@
1
+# Set various named options here.
2
+#
3
+OPTIONS=""
4
+
5
+# Set this to the number of processors you have.
6
+#
7
+CPU="1"
8
+
9
+# If you wish to run bind in a chroot, run:
10
+# emerge --config =<bind-version>
11
+# and un-comment the following line.
12
+# You can specify a different chroot directory but MAKE SURE it's empty.
13
+# CHROOT="/chroot/dns"
14
+
15
+# Default pid file location
16
+PIDFILE="${CHROOT}/var/run/named/named.pid"
17
+
18
+# Scheduling priority: 19 is the lowest and -20 is the highest.
19
+#
20
+NAMED_NICELEVEL="0"
... ...
@@ -0,0 +1,23 @@
1
+# Set various named options here.
2
+#
3
+OPTIONS=""
4
+
5
+# Set this to the number of processors you want bind to use.
6
+# Leave this unchanged if you want bind to automatically detect the number
7
+#CPU="1"
8
+
9
+# RNDC needs to be told what server we're using sometimes.
10
+#SERVER="-s 127.0.0.1"
11
+
12
+# If you wish to run bind in a chroot, run:
13
+# emerge --config =<bind-version>
14
+# and un-comment the following line.
15
+# You can specify a different chroot directory but MAKE SURE it's empty.
16
+# CHROOT="/chroot/dns"
17
+
18
+# Default pid file location
19
+PIDFILE="${CHROOT}/var/run/named/named.pid"
20
+
21
+# Scheduling priority: 19 is the lowest and -20 is the highest.
22
+#
23
+NAMED_NICELEVEL="0"
... ...
@@ -0,0 +1,71 @@
1
+#!/sbin/runscript
2
+# Copyright 1999-2004 Gentoo Foundation
3
+# Distributed under the terms of the GNU General Public License v2
4
+# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r5,v 1.1 2007/06/02 22:34:48 voxus Exp $
5
+
6
+opts="start stop reload restart"
7
+
8
+depend() {
9
+	need net
10
+	use logger
11
+	provide dns
12
+}
13
+
14
+checkconfig() {
15
+	if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
16
+		eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
17
+	fi
18
+	
19
+	# In case someone doesn't have $CPU set from /etc/conf.d/named
20
+	if [ ! ${CPU} ] ; then
21
+		CPU="1"
22
+	fi
23
+
24
+	# as suggested in bug #107724
25
+	[ -n "${PIDFILE}" ] || PIDFILE=${CHROOT}$(\
26
+		egrep -v \
27
+			"^([[:cntrl:] ]+(#|//|/\*)|(#|//|/\*))" \
28
+			${CHROOT}/etc/bind/named.conf \
29
+				| egrep -o -m1 "pid\-file +\".+\" *;" \
30
+				| cut -d\" -f2
31
+	)
32
+
33
+	KEY="${CHROOT}/etc/bind/rndc.key"
34
+}
35
+
36
+start() {
37
+	ebegin "Starting ${CHROOT:+chrooted }named"
38
+	checkconfig || return 1
39
+	start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
40
+		--nicelevel ${NAMED_NICELEVEL:-0} \
41
+		--exec /usr/sbin/named \
42
+		-- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t} ${CHROOT}
43
+	eend $?
44
+}
45
+
46
+stop() {
47
+	ebegin "Stopping ${CHROOT:+chrooted }named"
48
+	checkconfig || return 2
49
+	if [ -f $KEY ] ; then
50
+		rndc -k $KEY stop &>/dev/null
51
+	else
52
+		start-stop-daemon --stop --quiet --pidfile $PIDFILE \
53
+			--exec /usr/sbin/named -- stop
54
+	fi
55
+	eend $?
56
+}
57
+
58
+reload() {
59
+	checkconfig || return 3
60
+	if [ ! -f $PIDFILE ] ; then
61
+		/etc/init.d/named start &>/dev/null
62
+		exit
63
+	fi
64
+
65
+	if [ -f $KEY ] ; then
66
+		ebegin "Reloading named.conf and zone files"
67
+		rndc -k $KEY reload &>/dev/null
68
+		eend $?
69
+	else /etc/init.d/named restart &>/dev/null
70
+	fi
71
+}
... ...
@@ -0,0 +1,140 @@
1
+#!/sbin/runscript
2
+# Copyright 1999-2009 Gentoo Foundation
3
+# Distributed under the terms of the GNU General Public License v2
4
+# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r7,v 1.2 2010/02/25 19:03:31 robbat2 Exp $
5
+
6
+opts="start stop reload restart"
7
+
8
+depend() {
9
+	need net
10
+	use logger
11
+	after pg_autovacuum postgresql mysql ldap
12
+	provide dns
13
+}
14
+
15
+_mount() {
16
+	local from
17
+	local to
18
+	local opts
19
+
20
+	if [[ $# -lt 3 ]];
21
+	then
22
+		eerror "_mount(): to few arguments"
23
+		return 1
24
+	fi
25
+
26
+	from=$1
27
+	to=$2
28
+	shift 2
29
+	
30
+	opts="${*}"
31
+	shift $#
32
+
33
+	if [[ -z $(grep "${to}" /proc/mounts) ]];
34
+	then
35
+		einfo "mounting ${from} to ${to}"
36
+		mount ${from} ${to} ${opts} || return 1
37
+	fi
38
+}
39
+
40
+_umount() {
41
+	local dir=$1
42
+	
43
+	if [[ -n $(grep "${dir}" /proc/mounts) ]];
44
+	then
45
+		einfo "umount ${dir}"
46
+		umount ${dir}
47
+	fi
48
+}
49
+
50
+checkconfig() {
51
+	if [ ! -f ${CHROOT}/etc/bind/named.conf ] ; then
52
+		eerror "No ${CHROOT}/etc/bind/named.conf file exists!"
53
+	fi
54
+	
55
+	# In case someone have $CPU set in /etc/conf.d/named
56
+	if [ ${CPU} ] ; then
57
+		CPU="-n ${CPU}"
58
+	fi
59
+
60
+	# as suggested in bug #107724
61
+	[ -n "${PIDFILE}" ] || PIDFILE=${CHROOT}$(\
62
+		egrep -v \
63
+			"^([[:cntrl:] ]+(#|//|/\*)|(#|//|/\*))" \
64
+			${CHROOT}/etc/bind/named.conf \
65
+				| egrep -o -m1 "pid\-file +\".+\" *;" \
66
+				| cut -d\" -f2
67
+	)
68
+
69
+	KEY="${CHROOT}/etc/bind/rndc.key"
70
+}
71
+
72
+start() {
73
+	ebegin "Starting ${CHROOT:+chrooted }named"
74
+
75
+	if [[ -n ${CHROOT} ]];
76
+	then
77
+		einfo "Mounting chroot dirs"
78
+		_mount /etc/bind ${CHROOT}/etc/bind -o bind
79
+		_mount /var/bind ${CHROOT}/var/bind -o bind
80
+		_mount /var/log/named ${CHROOT}/var/log/named -o bind
81
+	fi
82
+
83
+	checkconfig || return 1
84
+
85
+	start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
86
+		--nicelevel ${NAMED_NICELEVEL:-0} \
87
+		--exec /usr/sbin/named \
88
+		-- -u named ${CPU} ${OPTIONS} ${CHROOT:+-t} ${CHROOT}
89
+	eend $?
90
+}
91
+
92
+stop() {
93
+	local reported=0
94
+
95
+	ebegin "Stopping ${CHROOT:+chrooted }named"
96
+	checkconfig || return 2
97
+	if [ -f $KEY ] ; then
98
+		rndc $SERVER -k $KEY stop &>/dev/null
99
+	else
100
+		start-stop-daemon --stop --quiet --pidfile $PIDFILE \
101
+			--exec /usr/sbin/named -- stop
102
+	fi
103
+
104
+	if [[ -n ${CHROOT} ]];
105
+	then
106
+		einfo "Umounting chroot dirs"
107
+
108
+		# just to be sure everything gets clean
109
+		while [[ -n $(fuser ${CHROOT} 2>&1) ]]
110
+		do
111
+			if [[ ${reported} -eq 0 ]];
112
+			then
113
+				einfo "Waiting until all named processes are stopped"
114
+				reported=1
115
+			fi
116
+			sleep 1
117
+		done
118
+
119
+		_umount ${CHROOT}/etc/bind
120
+		_umount ${CHROOT}/var/log/named
121
+		_umount ${CHROOT}/var/bind
122
+	fi
123
+
124
+	eend $?
125
+}
126
+
127
+reload() {
128
+	checkconfig || return 3
129
+	if [ ! -f $PIDFILE ] ; then
130
+		/etc/init.d/named start &>/dev/null
131
+		exit
132
+	fi
133
+
134
+	if [ -f $KEY ] ; then
135
+		ebegin "Reloading named.conf and zone files"
136
+		rndc $SERVER -k $KEY reload &>/dev/null
137
+		eend $?
138
+	else /etc/init.d/named restart &>/dev/null
139
+	fi
140
+}
0 141