# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils DESCRIPTION="An authoritative only, high performance, open source name server" HOMEPAGE="http://nlnetlabs.nl/nsd/index.html" SRC_URI="http://www.nlnetlabs.nl/downloads/${PN}/${P}.tar.gz" LICENSE="BSD-like" SLOT="0" KEYWORDS="~x86 ~amd64" # Any others? IUSE="tsig ipv6 dnssec bind8-stats runtime-checks nsec3 nsid root-server large-files tcpd" DEPEND="tsig? ( >=dev-libs/openssl-0.9.7 ) tcpd? ( sys-apps/tcp-wrappers )" RESTRICT="nomirror" RDEPEND="${DEPEND}" pkg_setup() { if use runtime-checks; then echo ewarn "runtime-checks USE-flag enabled:" ewarn "this could restrict some services and reduce perfomance." echo fi ebegin "Creating nsd group and user" enewgroup nsd 53 enewuser nsd 53 -1 /etc/nsd nsd eend $? use nsec3 && ewarn "NSEC3 support is still experemental! Use it at your own risk" use nsid && ewarn "NSID support is still experemental! Use it at your own risk" } src_compile() { local runtime_vars="/var/run/${PN}" local permanent_vars="/var/lib/${PN}" econf \ --with-user=nsd \ --with-configdir=/etc/nsd \ --with-pidfile=${runtime_vars}/nsd.pid \ --with-xfrdfile=${runtime_vars}/xfrd.state \ --with-difffile=${runtime_vars}/ixfr.db \ --with-zonesdir=${permanent_vars} \ --with-dbfile=${permanent_vars}/nsd.db \ $(use_enable ipv6) \ $(use_enable tsig) \ $(use_enable runtime-checks checking) \ $(use_enable bind8-stats) \ $(use_enable dnssec) \ $(use_enable nsid) \ $(use_enable nsec3) \ $(use_enable root-server) \ $(use_enable large-files largefile) \ ${myconf} || die "econf failed" emake || die "failed to compile bind" } src_install() { local config_vars="/etc/${PN}" local runtime_vars="/var/run/${PN}" local permanent_vars="/var/lib/${PN}" local nsd_owned_dirs=( config_vars runtime_vars permanent_vars ) # Modify nsd.conf.sample file to show separate master and slave zones local change_maps=( "signed.zone master" ".zone slave" ) for (( i=0; $i<2; i=$i+1 )); do local change_map=${change_maps[$i]} set ${change_map} sed -r "s|(zonefile:\s*)\"([[:alpha:]\.]+$1)\"|\1\"$2/\2\"|" -i nsd.conf.sample set -- done; emake DESTDIR="${D}" install || die "failed to install bind" dodoc doc/* dodoc contrib/nsd.zones2nsd.conf dodoc "${FILESDIR}"/nsd.cron dobin nsdc.sh newinitd "${FILESDIR}"/nsd.initd nsd keepdir ${runtime_vars} keepdir ${permanent_vars} dodir ${permanent_vars}/master dodir ${permanent_vars}/slave dosym ${permanent_vars}/master ${config_vars} dosym ${permanent_vars}/slave ${config_vars} for var_name in ${nsd_owned_dirs[@]}; do fowners -R nsd:nsd ${!var_name} find ${!var_name} -type d -exec chmod 750 {} + find ${!var_name} -type f -exec chmod 640 {} + done; } pkg_postinst() { elog "If you are using bind and want to convert (or sync) bind zones:" elog "take a look on bind2nsd (http://bind2nsd.sourceforge.net)" echo elog "Also, if you are upgrading from old versions," elog "you may be interested in nsd.zones -> nsd.conf conveter script." elog "It's now located at NSD doc (usually /usr/share/doc/${P}/) dir" echo elog "NSD automatically tracks and updates it's secondary zones," elog "but, in way to prevent loosing data from connection lost during update," elog "it writes all updates in journal file and provides 'nsdc patch'" elog "command to apply this changes permanently. Check for nsd.cron file" elog "inside your doc dir and place it in preferred cron.* sheldue dir" }