summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Ruppert <idl0r@gentoo.org>2009-07-19 19:57:22 +0000
committerChristian Ruppert <idl0r@gentoo.org>2009-07-19 19:57:22 +0000
commitf6c8f61ace9d5322d6f4ba53d61f24136b0d00f6 (patch)
tree9cbc2a5ae1445a8f24d04bf9eb966696b1ae6d3b /net-dns
parentPackage move x11-plugins/pidgin-msn-pecan to x11-plugins/msn-pecan (diff)
downloadhistorical-f6c8f61ace9d5322d6f4ba53d61f24136b0d00f6.tar.gz
historical-f6c8f61ace9d5322d6f4ba53d61f24136b0d00f6.tar.bz2
historical-f6c8f61ace9d5322d6f4ba53d61f24136b0d00f6.zip
Version bump to 9.6.1, bug 274494. Fix bug 275684. Add xml useflags. append-flags -D_GNU_SOURCE is not needed anymore since it has been fixed by upstream. Fix HOMEPAGE. Cleanup.
Package-Manager: portage-2.2_rc33/cvs/Linux x86_64
Diffstat (limited to 'net-dns')
-rw-r--r--net-dns/bind/ChangeLog10
-rw-r--r--net-dns/bind/Manifest15
-rw-r--r--net-dns/bind/bind-9.6.1.ebuild302
-rw-r--r--net-dns/bind/files/named.init-r6141
4 files changed, 456 insertions, 12 deletions
diff --git a/net-dns/bind/ChangeLog b/net-dns/bind/ChangeLog
index 903f64f00604..c5e80ce93964 100644
--- a/net-dns/bind/ChangeLog
+++ b/net-dns/bind/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for net-dns/bind
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v 1.231 2009/05/31 13:33:01 ikelos Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/ChangeLog,v 1.232 2009/07/19 19:57:22 idl0r Exp $
+
+*bind-9.6.1 (19 Jul 2009)
+
+ 19 Jul 2009; Christian Ruppert <idl0r@gentoo.org> +bind-9.6.1.ebuild,
+ +files/named.init-r6:
+ Version bump to 9.6.1, bug 274494. Fix bug 275684. Add xml useflags.
+ append-flags -D_GNU_SOURCE is not needed anymore since it has been fixed
+ by upstream. Fix HOMEPAGE. Cleanup.
31 May 2009; Mike Auty <ikelos@gentoo.org> metadata.xml:
Fixing typo in local USE flag description (see bug 271604).
diff --git a/net-dns/bind/Manifest b/net-dns/bind/Manifest
index e6e60a4dbad1..0468a7340f3d 100644
--- a/net-dns/bind/Manifest
+++ b/net-dns/bind/Manifest
@@ -1,6 +1,3 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
AUX 10bind.env 27 RMD160 872245707b4f72a212cda162c59495744d77a6e3 SHA1 7b8c1abd5910bb7a07c6b7c820c2b34a534b2593 SHA256 5ad6a4402372b43809618051873b63646746f400447bba30dc4dfecd028e3650
AUX 127.zone 227 RMD160 66ab92f201d71da613702a85806d2e8d27f6516f SHA1 6787635fd44b1f29dc34b31053ca28e4353f69e0 SHA256 65b909fc1398dfa5b532ab395d6920758937093cf7e5b5bec8242dff4fe15e89
AUX 127.zone-r1 533 RMD160 2795c6c27912a73ac45582f33de3182382db3a5d SHA1 87fcb2b96db4cef99d25fa87759dd32ea2ac5559 SHA256 0fa4c294640d4191710647d1b18a2099f22ff674b3a35e6e81ff929f921da626
@@ -18,11 +15,13 @@ AUX named.confd-r1 392 RMD160 eb80118694d541aeb06df96473ca7d226adf0f6c SHA1 8a0a
AUX named.confd-r2 479 RMD160 0a0452bf9bb6f18d4628ee72abe82a52d484a2cb SHA1 d0b0e2f5d72d43862c5aaff9a226fd8599992323 SHA256 bae05257852ecbc7f66bd30e452162f15b6f6e8c3fc170fb6dfdfa7d22361915
AUX named.init-r4 1585 RMD160 30ed0f443f0ec1b63d3fd15e4d32fc79ad6199af SHA1 e600929124b4e993552896f6f111f06a706fed89 SHA256 f2eb9393a7380f670af0e09bd378cf619681e33b81ed7e5c7f5b7a1b01964821
AUX named.init-r5 1620 RMD160 37279362e437241188a07e5f274730e68645827e SHA1 00a14819a322b391183084c79cc9a4dc04d0d484 SHA256 07fb9d653f086319680d04abde0218495ed09d3528087257788bf294252a0bad
+AUX named.init-r6 2739 RMD160 ed0ade25cf62795adcc14dd7d87fac82fbb025cc SHA1 2268af2b3aeec9ac8fff4486249e6882a1b89fa1 SHA256 bff833d8f7ea0d4427905184797037c37cdae8fdae0ee004adbdd8b576083742
DIST bind-9.4.2-P2.tar.gz 6456550 RMD160 c0934436914cbc0963298cec326fe14a73130873 SHA1 e6aebf6e73dfd4d8ccae397bc5cafaa17fbc5ce4 SHA256 eddf17749abb469bd67213c151450c8e07414d7fcf5a4cd0dc6c03da9656d74d
DIST bind-9.4.3-P1.tar.gz 6544583 RMD160 f7bc80a50c03f241d37c3bc4cfe52d936675f8c3 SHA1 3aff02f8c7c0c79dc589b9ce9af28bae386d44cf SHA256 6f4323db5b55105a83a71517f42c0e6f1defdeefa7156b5ebe035480e2755c8a
DIST bind-9.4.3-P2.tar.gz 6544865 RMD160 89d7c41a8c04833f4427914857f91ffffb0ac5ee SHA1 6ef00b9db269180e4cfa2ea3fe06f7ab9bc7cfa0 SHA256 fb7c9964942ecc07606bb8d4361bf9d9bd8091e059fea1b56e6a0972f99b1ba1
DIST bind-9.5.1-P2.tar.gz 6690701 RMD160 e57cad26efc3ad4aea17aaf2cce506c69c70a643 SHA1 5c122d1abf8edfe53f86059e67e28753935f62f5 SHA256 c72fffbba3be1e00109e780fafb83cf1aa3a122ad825b01be71182e82b019560
DIST bind-9.6.0-P1.tar.gz 6526739 RMD160 4507987e293b79e57ad6b87dd84012030d5b1d6e SHA1 c2b703d05fc768f63f028b0812c46d6eb81c145d SHA256 4ccbd33a5b5c974c2778d5e61eeb4841c04a40904db43ee1ad190c3ed82978a9
+DIST bind-9.6.1.tar.gz 6724683 RMD160 18431b1418eda7298295945d63d5ad185f19d78f SHA1 50c485a152b566ca89d082e5d6f777c00f0a92b2 SHA256 58968b601ebb66be73c32d69111afd6dd17f087e1bff12030f0dc2dada76d7cf
DIST bind-sdb-ldap-1.1.0.tar.bz2 5883 RMD160 ec2f684f278e5fa72158486a14dfce3005a62602 SHA1 fae539a29615fda56a2dcb55a1e01d335835b980 SHA256 afe9cc6a99c20f1dc1929b0a30ff815b0aac509a6c12f8df432853c856d35754
DIST dyndns-samples.tbz2 22866 RMD160 27d5b2d0edb8e1ff16b3f980c38d7af33ccf0c7d SHA1 0a62e9458d0e16b67a3a2f63ea485ce969f1fb4d SHA256 92fb06a92ca99cbbe96b90bcca229ef9c12397db57ae17e199dad9f1218fdbe8
EBUILD bind-9.4.2_p2.ebuild 8892 RMD160 fcfbafe653b3682e6971b81428b66df449ed6112 SHA1 42391b42f101ac7e5520ec6b8d3b72b53cffbc9e SHA256 d509903697b03456ec7470174298b60219eca288df36da7c9bc159c8445c8aec
@@ -30,12 +29,6 @@ EBUILD bind-9.4.3_p1.ebuild 9217 RMD160 442d54b9293e0451403977b0c2cb70eeba402dec
EBUILD bind-9.4.3_p2.ebuild 9213 RMD160 1e4d6db34438c0bb9f5996c5429f29e1cf63fd00 SHA1 c21db5b43d12eeb3f9ded54efa8a92df8b9ddfbf SHA256 8c4533cf5656d4268bab787b1b87ca296fbcdd131c28afcc02c47899505cb5f4
EBUILD bind-9.5.1_p2.ebuild 9633 RMD160 50145acdb25031c929fbf9982fe2238c1f007484 SHA1 d4c2e811efb787001cb747eaf4caf43939f5993e SHA256 8d94649c99cd3e20d9043b556c5d43325b5348c34b09228b3b9de22c1bd10f49
EBUILD bind-9.6.0_p1.ebuild 9633 RMD160 f4c75c32debc28370929a841cae9f3f40c947663 SHA1 c139adfe81f6548314b5dbf32dd852e9955d060c SHA256 120628d9e7ced480b335616e804d13e60112c1316a6803b585408de0a147ae54
-MISC ChangeLog 37602 RMD160 bd4ee1e7fcfd48ed85bd85491b735c4912db668f SHA1 54ed93fdadf245e3423b00719019705477a9f762 SHA256 7fc7f01a0d709fcf6b676041eccaad49f287f5f3ea3dd188a7ca313c48b26747
+EBUILD bind-9.6.1.ebuild 9279 RMD160 d904bd02093dea664917709358623d2471fe5c04 SHA1 7fa2bb34c9328f4d76591906f19a8cd8ad312364 SHA256 af744eacd41b54061290ed0bcd88d948922425a093df991568a2fee9096aaff3
+MISC ChangeLog 37909 RMD160 a7ecb04ba77b45a85b44713a0e45321070fb4fd5 SHA1 0e352726486e53dcf25eb497a7d35640c25edbef SHA256 d91c58ed3119d57f8536f3b74a43c679e39d1d463f8dc093777d893ee37234b2
MISC metadata.xml 647 RMD160 63aeb182631d45c774bdc08f11901147028f6d7c SHA1 9aff80992005daa758d373c4e3311ff8c3ae3ef9 SHA256 9417c62e0e5817e26d36ab5efd87f126781dbf445d9a1beb3abb899b8cb4806a
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.11 (GNU/Linux)
-
-iEYEARECAAYFAkoihxMACgkQu7rWomwgFXrs5ACdE8qIOPSNTvI6gpAFOmQVcNiu
-aa8AnicDMTqQaUl2VX5eFeGRPyCOFaow
-=sKDG
------END PGP SIGNATURE-----
diff --git a/net-dns/bind/bind-9.6.1.ebuild b/net-dns/bind/bind-9.6.1.ebuild
new file mode 100644
index 000000000000..ccce54d7c74d
--- /dev/null
+++ b/net-dns/bind/bind-9.6.1.ebuild
@@ -0,0 +1,302 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.6.1.ebuild,v 1.1 2009/07/19 19:57:22 idl0r Exp $
+
+EAPI="2"
+
+inherit eutils autotools toolchain-funcs flag-o-matic
+
+MY_PV="${PV/_p1/-P1}"
+MY_P="${PN}-${MY_PV}"
+
+SDB_LDAP_VER="1.1.0"
+
+DESCRIPTION="BIND - Berkeley Internet Name Domain - Name Server"
+HOMEPAGE="https://www.isc.org/software/bind"
+SRC_URI="ftp://ftp.isc.org/isc/bind9/${MY_PV}/${MY_P}.tar.gz
+ sdb-ldap? ( mirror://gentoo/bind-sdb-ldap-${SDB_LDAP_VER}.tar.bz2 )
+ doc? ( mirror://gentoo/dyndns-samples.tbz2 )"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="ssl ipv6 doc dlz postgres berkdb mysql odbc ldap selinux idn threads
+ resolvconf urandom sdb-ldap xml"
+
+DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
+ mysql? ( >=virtual/mysql-4.0 )
+ odbc? ( >=dev-db/unixODBC-2.2.6 )
+ ldap? ( net-nds/openldap )
+ idn? ( net-dns/idnkit )
+ postgres? ( virtual/postgresql-base )
+ threads? ( >=sys-libs/libcap-2.1.0 )
+ xml? ( dev-libs/libxml2 )"
+
+RDEPEND="${DEPEND}
+ selinux? ( sec-policy/selinux-bind )
+ resolvconf? ( net-dns/openresolv )"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ use threads && {
+ ewarn
+ ewarn "If you're in vserver enviroment, you're probably want to"
+ ewarn "disable threads support because of linux capabilities dependency"
+ ewarn
+ }
+
+ ebegin "Creating named group and user"
+ enewgroup named 40
+ enewuser named 40 -1 /etc/bind named
+ eend ${?}
+}
+
+src_prepare() {
+ # Adjusting PATHs in manpages
+ for i in bin/{named/named.8,check/named-checkconf.8,rndc/rndc.8} ; do
+ sed -i \
+ -e 's:/etc/named.conf:/etc/bind/named.conf:g' \
+ -e 's:/etc/rndc.conf:/etc/bind/rndc.conf:g' \
+ -e 's:/etc/rndc.key:/etc/bind/rndc.key:g' \
+ "${i}" || die "sed failed, ${i} doesn't exist"
+ done
+
+ use dlz && epatch "${FILESDIR}"/${PN}-9.4.0-dlzbdb-close_cursor.patch
+
+ # bind fails to reconnect to MySQL5 databases, bug #180720, patch by Nicolas Brousse
+ # (http://www.shell-tips.com/2007/09/04/bind-950-patch-dlz-mysql-5-for-auto-reconnect/)
+ use dlz && use mysql && has_version ">=dev-db/mysql-5" && epatch "${FILESDIR}"/bind-dlzmysql5-reconnect.patch
+
+ # should be installed by bind-tools
+ sed -i -e "s:nsupdate ::g" bin/Makefile.in || die
+
+ # sdb-ldap patch as per bug #160567
+ # Upstream URL: http://bind9-ldap.bayour.com/
+ use sdb-ldap && epatch "${WORKDIR}"/sdb-ldap/${PN}-sdb-ldap-${SDB_LDAP_VER}.patch
+
+ # bug #220361
+ rm {aclocal,libtool}.m4
+ WANT_AUTOCONF=2.5 AT_NO_RECURSIVE=1 eautoreconf
+
+ # bug #151839
+ sed -i -e \
+ 's:struct isc_socket {:#undef SO_BSDCOMPAT\n\nstruct isc_socket {:' \
+ lib/isc/unix/socket.c || die
+
+ # remove useless c++ checks
+ epunt_cxx
+}
+
+src_configure() {
+ local myconf=""
+
+ use dlz && {
+ myconf="${myconf} --with-dlz-filesystem --with-dlz-stub"
+ use postgres && myconf="${myconf} --with-dlz-postgres"
+ use mysql && myconf="${myconf} --with-dlz-mysql"
+ use berkdb && myconf="${myconf} --with-dlz-bdb"
+ use ldap && myconf="${myconf} --with-dlz-ldap"
+ use odbc && myconf="${myconf} --with-dlz-odbc"
+ }
+
+ if use threads; then
+ if use dlz && use mysql; then
+ ewarn
+ ewarn "MySQL uses thread local storage in its C api. Thus MySQL"
+ ewarn "requires that each thread of an application execute a MySQL"
+ ewarn "\"thread initialization\" to setup the thread local storage."
+ ewarn "This is impossible to do safely while staying within the DLZ"
+ ewarn "driver API. This is a limitation caused by MySQL, and not"
+ ewarn "the DLZ API."
+ ewarn "Because of this BIND MUST only run with a single thread when"
+ ewarn "using the MySQL driver."
+ ewarn
+ myconf="${myconf} --disable-linux-caps --disable-threads"
+ ewarn "Threading support disabled"
+ epause 10
+ else
+ myconf="${myconf} --enable-linux-caps --enable-threads"
+ einfo "Threading support enabled"
+ fi
+ else
+ myconf="${myconf} --disable-linux-caps --disable-threads"
+ fi
+
+ if use urandom; then
+ myconf="${myconf} --with-randomdev=/dev/urandom"
+ else
+ myconf="${myconf} --with-randomdev=/dev/random"
+ fi
+
+ # bug #158664
+ gcc-specs-ssp && replace-flags -O[23s] -O
+ export BUILD_CC="${CBUILD}-gcc"
+ econf \
+ --sysconfdir=/etc/bind \
+ --localstatedir=/var \
+ --with-libtool \
+ $(use_with ssl openssl) \
+ $(use_with idn) \
+ $(use_enable ipv6) \
+ $(use_with xml libxml2) \
+ ${myconf}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ dodoc CHANGES FAQ KNOWN-DEFECTS README || die
+
+ if use idn; then
+ dodoc README.idnkit || die
+ fi
+
+ if use doc; then
+ dodoc doc/arm/Bv9ARM.pdf || die
+
+ docinto misc
+ dodoc doc/misc/* || die
+
+ # might a 'html' useflag make sense?
+ docinto html
+ dohtml -r doc/arm/* || die
+
+ docinto draft
+ dodoc doc/draft/* || die
+
+ docinto rfc
+ dodoc doc/rfc/* || die
+
+ docinto contrib
+ dodoc contrib/named-bootconf/named-bootconf.sh \
+ contrib/nanny/nanny.pl || die
+
+ # some handy-dandy dynamic dns examples
+ cd "${D}"/usr/share/doc/${PF}
+ tar xf "${DISTDIR}"/dyndns-samples.tbz2 || die
+ fi
+
+ newenvd "${FILESDIR}"/10bind.env 10bind || die
+
+ keepdir /var/bind/sec
+
+ insinto /etc/bind
+ newins "${FILESDIR}"/named.conf-r3 named.conf || die
+
+ # ftp://ftp.rs.internic.net/domain/named.ca:
+ insinto /var/bind
+ doins "${FILESDIR}"/named.ca || die
+
+ insinto /var/bind/pri
+ newins "${FILESDIR}"/127.zone-r1 127.zone || die
+ newins "${FILESDIR}"/localhost.zone-r3 localhost.zone || die
+
+ newinitd "${FILESDIR}"/named.init-r6 named || die
+ newconfd "${FILESDIR}"/named.confd-r2 named || die
+
+ dosym /var/bind/named.ca /var/bind/root.cache
+ dosym /var/bind/pri /etc/bind/pri
+ dosym /var/bind/sec /etc/bind/sec
+
+ # Let's get rid of those tools and their manpages since they're provided by bind-tools
+ rm -f "${D}"/usr/share/man/man1/{dig,host,nslookup}.1
+ rm -f "${D}"/usr/share/man/man8/{dnssec-keygen,nsupdate}.8
+ rm -f "${D}"/usr/bin/{dig,host,nslookup,dnssec-keygen,nsupdate}
+}
+
+pkg_postinst() {
+ if [ ! -f '/etc/bind/rndc.key' ]; then
+ if [ -c /dev/urandom ]; then
+ einfo "Using /dev/urandom for generating rndc.key"
+ /usr/sbin/rndc-confgen -r /dev/urandom -a -u named
+ echo
+ else
+ einfo "Using /dev/random for generating rndc.key"
+ /usr/sbin/rndc-confgen -a -u named
+ echo
+ fi
+ fi
+
+ install -d -o named -g named "${ROOT}"/var/run/named \
+ "${ROOT}"/var/bind/{pri,sec} "${ROOT}"/var/log/named
+ chown -R named:named "${ROOT}"/var/bind
+
+ elog "The default zone files are now installed as *.zone,"
+ elog "be careful merging config files if you have modified"
+ elog "/var/bind/pri/127 or /var/bind/pri/localhost"
+ elog
+ elog "You can edit /etc/conf.d/named to customize named settings"
+ elog
+ elog "The BIND ebuild now includes chroot support."
+ elog "If you like to run bind in chroot AND this is a new install OR"
+ elog "your bind doesn't already run in chroot, simply run:"
+ elog "\`emerge --config '=${CATEGORY}/${PF}'\`"
+ elog "Before running the above command you might want to change the chroot"
+ elog "dir in /etc/conf.d/named. Otherwise /chroot/dns will be used."
+ elog
+ elog "Recently verisign added a wildcard A record to the .COM and .NET TLD"
+ elog "zones making all .com and .net domains appear to be registered"
+ elog "This causes many problems such as breaking important anti-spam checks"
+ elog "which verify source domains exist. ISC released a patch for BIND which"
+ elog "adds 'delegation-only' zones to allow admins to return the .com and .net"
+ elog "domain resolution to their normal function."
+ elog
+ elog "There is no need to create a com or net data file. Just the"
+ elog "entries to the named.conf file is enough."
+ elog
+ elog " zone "com" IN { type delegation-only; };"
+ elog " zone "net" IN { type delegation-only; };"
+
+ ewarn
+ ewarn "BIND >=9.2.5 makes the priority argument to MX records mandatory"
+ ewarn "when it was previously optional. If the priority is missing, BIND"
+ ewarn "won't load the zone file at all."
+ ewarn
+
+ ewarn "NOTE: as of 'bind-9.6.1' the chroot part of the init-script got some major changes."
+}
+
+pkg_config() {
+ CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/named 2>/dev/null`
+ EXISTS="no"
+
+ if [ -z "${CHROOT}" -a ! -d "/chroot/dns" ]; then
+ CHROOT="/chroot/dns"
+ elif [ -d ${CHROOT} ]; then
+ eerror; eerror "${CHROOT:-/chroot/dns} already exists. Quitting."; eerror; EXISTS="yes"
+ fi
+
+ if [ ! "$EXISTS" = yes ]; then
+ einfo ; einfon "Setting up the chroot directory..."
+
+ mkdir -m 750 -p ${CHROOT}
+ mkdir -p ${CHROOT}/{dev,proc,etc/bind,var/{run,log}/named,var/bind}
+ chown -R named:named ${CHROOT}
+ chown root:named ${CHROOT}
+
+ cp /etc/localtime ${CHROOT}/etc/localtime
+
+ mknod ${CHROOT}/dev/zero c 1 5
+ chmod 666 ${CHROOT}/dev/zero
+
+ if use urandom; then
+ mknod ${CHROOT}/dev/urandom c 1 9
+ chmod 666 ${CHROOT}/dev/urandom
+ else
+ mknod ${CHROOT}/dev/random c 1 8
+ chmod 666 ${CHROOT}/dev/random
+ fi
+
+ if [ -f '/etc/syslog-ng/syslog-ng.conf' ]; then
+ echo "source jail { unix-stream(\"${CHROOT}/dev/log\"); };" >>/etc/syslog-ng/syslog-ng.conf
+ fi
+
+ grep -q "^#[[:blank:]]\?CHROOT" /etc/conf.d/named ; RETVAL=$?
+ if [ $RETVAL = 0 ]; then
+ sed -i 's/^# \?\(CHROOT.*\)$/\1/' /etc/conf.d/named 2>/dev/null
+ fi
+ else
+ ewarn "NOTE: as of 'bind-9.6.1' the chroot part of the init-script got some major changes."
+ fi
+}
diff --git a/net-dns/bind/files/named.init-r6 b/net-dns/bind/files/named.init-r6
new file mode 100644
index 000000000000..d4fc0e55fc30
--- /dev/null
+++ b/net-dns/bind/files/named.init-r6
@@ -0,0 +1,141 @@
+#!/sbin/runscript
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r6,v 1.1 2009/07/19 19:57:22 idl0r Exp $
+
+opts="start stop reload restart"
+
+depend() {
+ need net
+ use logger
+ provide dns
+}
+
+_mount() {
+ local from
+ local to
+ local opts
+
+ if [[ $# -lt 3 ]];
+ then
+ eerror "_mount(): to few arguments"
+ return 1
+ fi
+
+ from=$1
+ to=$2
+ shift 2
+
+ opts="${*}"
+ shift $#
+
+ if [[ -z $(grep "${to}" /proc/mounts) ]];
+ then
+ einfo "mounting ${from} to ${to}"
+ mount ${from} ${to} ${opts} || return 1
+ fi
+}
+
+_umount() {
+ local dir=$1
+
+ if [[ -n $(grep "${dir}" /proc/mounts) ]];
+ then
+ einfo "umount ${dir}"
+ umount ${dir}
+ fi
+}
+
+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"
+
+ if [[ -n ${CHROOT} ]];
+ then
+ einfo "Mounting chroot dirs"
+ _mount none ${CHROOT}/proc -t proc
+ _mount /etc/bind ${CHROOT}/etc/bind -o bind
+ _mount /var/bind ${CHROOT}/var/bind -o bind
+ _mount /var/log/named ${CHROOT}/var/log/named -o bind
+ fi
+
+ checkconfig || return 1
+
+ start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
+ --nicelevel ${NAMED_NICELEVEL:-0} \
+ --exec /usr/sbin/named \
+ -- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t} ${CHROOT}
+ eend $?
+}
+
+stop() {
+ local reported=0
+
+ 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
+
+ if [[ -n ${CHROOT} ]];
+ then
+ einfo "Umounting chroot dirs"
+
+ # just to be sure everything gets clean
+ while [[ -n $(fuser ${CHROOT} 2>&1) ]]
+ do
+ if [[ ${reported} -eq 0 ]];
+ then
+ einfo "Waiting until all named processes are stopped"
+ reported=1
+ fi
+ sleep 1
+ done
+
+ _umount ${CHROOT}/etc/bind
+ _umount ${CHROOT}/var/log/named
+ _umount ${CHROOT}/var/bind
+ _umount ${CHROOT}/proc
+ 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
+}