Commit d1d115d7 authored by Carlo Lanmdeter's avatar Carlo Lanmdeter

extra/bind: removed chroot, we can use vserver for this kind of setup.

parent 648b7e8c
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=bind
pkgver=9.6.0_p1
pkgrel=0
......@@ -17,7 +16,6 @@ $pkgname.confd
$pkgname.conf
$pkgname.127.zone
$pkgname.localhost.zone
$pkgname.envd
$pkgname.named.ca
$pkgname.install"
......@@ -55,28 +53,28 @@ build() {
make || return 1
make DESTDIR="$pkgdir" install
depends="$depends $pkgname-libs"
install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname || return 1
install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname || return 1
install -Dm644 "$srcdir"/$pkgname.conf "$pkgdir"/etc/bind/$pkgname.conf || return 1
install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/named || return 1
install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/named || return 1
install -Dm644 "$srcdir"/$pkgname.conf "$pkgdir"/etc/bind/named.conf || return 1
install -Dm644 "$srcdir"/$pkgname.named.ca "$pkgdir"/var/bind/named.ca || return 1
install -Dm644 "$srcdir"/$pkgname.127.zone "$pkgdir"/var/bind/pri/127.zone || return 1
install -Dm644 "$srcdir"/$pkgname.localhost.zone "$pkgdir"/var/bind/pri/localhost.zone || return 1
install -Dm644 "$srcdir"/$pkgname.envd "$pkgdir"/etc/env.d/10bind || return 1
mkdir -p "$pkgdir"/var/bind/sec || return 1
cd "$pkgdir"/etc/bind
ln -s ../../var/bind/pri pri || return 1
ln -s ../../var/bind/sec sec || return 1
cd "$pkgdir"/var/bind
ln -s named.ca root.cache || return 1
}
libs() {
install=""
mkdir -p "$subpkgdir"/usr
mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
}
tools() {
install=""
depends="$pkgname-libs"
mkdir -p "$subpkgdir"/usr/bin
for i in dig host nslookup nsupdate; do
......@@ -86,11 +84,10 @@ tools() {
md5sums="886b7eae55cfdc8cd8d2ca74a2f99c6e bind-9.6.0-P1.tar.gz
f270a5b0a28ab6e818840c5c368ddbcc bind.so_bsdcompat.patch
3aebea7be2340d971354bd9188a042dc bind.initd
5b0a78ca9da95ad2d3504cc0ef2dc32e bind.confd
3adc904c1c12f81839d9369f7241022b bind.initd
8b05a287976d66d51c18b73ee7523671 bind.confd
be5fd752bdbd59385f2a559d603098d5 bind.conf
a7455b009b7fccd74ac6f6eaa6902a00 bind.127.zone
c3220168fabfb31a25e8c3a545545e34 bind.localhost.zone
42b5ed5adcee33cf40531d7955412b21 bind.envd
a94e29ac677846f3d4d618c50b7d34f1 bind.named.ca
8449d77a1bc4cf4010589ed8ecbea39a bind.install"
65a324ab73d4ce8720a07b46a391f58a bind.install"
# Set various named options here.
#
OPTIONS=""
OPTS=""
# Set this to the number of processors you have.
#
CPU="1"
# If you don't wish to run bind in a chroot, comment out the following line:
CHROOT="/chroot/dns"
# User which named should run as
USER="named"
# Default pid file location
PIDFILE="${CHROOT}/var/run/named/named.pid"
PIDFILE="/var/run/named/named.pid"
# Scheduling priority: 19 is the lowest and -20 is the highest.
#
NAMED_NICELEVEL="0"
NICELEVEL="0"
CONFIG_PROTECT="/var/bind"
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dns/bind/files/named.init-r5,v 1.1 2007/06/02 22:34:48 voxus Exp $
opts="start stop reload restart"
NAME=named
DAEMON=/usr/sbin/$NAME
depend() {
need net
......@@ -11,73 +9,16 @@ depend() {
provide dns
}
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"
}
init_rndc_key() {
[ -f "$KEY" ] && return
if [ -c /dev/urandom ]; then
einfo "Using /dev/urandom for generating rndc.key"
/usr/sbin/rndc-confgen -r /dev/urandom -a -u named -c "$KEY"
else
einfo "Using /dev/random for generating rndc.key"
/usr/sbin/rndc-confgen -a -u named -c "$KEY"
fi
}
start() {
ebegin "Starting ${CHROOT:+chrooted }named"
checkconfig || return 1
init_rndc_key
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--nicelevel ${NAMED_NICELEVEL:-0} \
--exec /usr/sbin/named \
-- -u named -n ${CPU} ${OPTIONS} ${CHROOT:+-t} ${CHROOT}
ebegin "Starting ${NAME}"
start-stop-daemon --start --quiet --background \
--exec ${DAEMON} --nicelevel ${NICELEVEL} \
-- -u ${USER} -n ${CPU} ${OPTS}
eend $?
}
stop() {
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
ebegin "Stopping ${NAME}"
start-stop-daemon --stop --quiet --pidfile $PIDFILE
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
}
......@@ -3,32 +3,9 @@
case "$1" in
pre_install)
adduser -h /etc/bind -s /bin/false -D named 2>/dev/null
;;
post_install)
CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' $ROOT/etc/conf.d/named 2>/dev/null`
[ -z "$CHROOT" ] && CHROOT=/chroot/dns
if [ -d "$CHROOT" ] ; then
echo "$CHROOT already exist. Will not set up chroot"
exit 0
fi
# Set up the chroot
mkdir -m 700 -p ${CHROOT}
for i in dev etc var/run/named ; do
mkdir -p "${CHROOT}/$i"
done
mkdir -p "$ROOT/var/run/named"
chown -R named:named "${CHROOT}/var/run/named"
chown -R named:named "$ROOT/var/run/named"
cp -R "$ROOT/etc/bind" "${CHROOT}/etc/"
cp /etc/TZ ${CHROOT}/etc/TZ
#chown named:named ${CHROOT}/etc/bind/rndc.key
cp -R /var/bind "${CHROOT}/var/"
chown -R named:named "${CHROOT}/var/"
mknod "${CHROOT}/dev/zero" c 1 5
mknod "${CHROOT}/dev/random" c 1 8
chmod 666 "${CHROOT}/dev/random" "${CHROOT}/dev/zero"
chown named:named "${CHROOT}"
;;
post_install)
install -dD -o named -g named /var/run/named
chown -R named:named /var/bind
esac
exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment