summaryrefslogtreecommitdiffstats
path: root/extra/bind/bind.install
diff options
context:
space:
mode:
Diffstat (limited to 'extra/bind/bind.install')
-rw-r--r--extra/bind/bind.install34
1 files changed, 34 insertions, 0 deletions
diff --git a/extra/bind/bind.install b/extra/bind/bind.install
new file mode 100644
index 00000000..e3e4d4a2
--- /dev/null
+++ b/extra/bind/bind.install
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+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}"
+esac
+exit 0
+