3 # Configure Bind 9 for GForge
4 # Christian Bayle, Roland Mas, debian-sf (GForge for Debian)
8 if [ $(id -u) != 0 ] ; then
9 echo "You must be root to run this, please enter passwd"
16 cp -a /etc/bind/named.conf /etc/bind/named.conf.gforge-new
17 domain_name=$(perl -e'require "/etc/gforge/local.pl"; print "$domain_name\n";')
18 ip_address=$(perl -e'require "/etc/gforge/local.pl"; print "$sys_ip_address\n";')
19 # export domain_name=$1
20 # export ip_address=$2
21 if ! grep -q "// Next line inserted by GForge install" /etc/bind/named.conf.gforge-new ; then
22 cat >> /etc/bind/named.conf.gforge-new <<-EOF
23 // Next line inserted by GForge install
24 zone "$domain_name" { type master; file "/var/lib/gforge/bind/dns.zone"; };
29 domain_name=$(perl -e'require "/etc/gforge/local.pl"; print "$domain_name\n";')
30 ip_address=$(perl -e'require "/etc/gforge/local.pl"; print "$sys_ip_address\n";')
31 sys_simple_dns=$(perl -e'require "/etc/gforge/local.pl"; print "$sys_simple_dns\n";')
32 serial=`date '+%Y%m%d'`01
33 # scm_host lists_host are useless for now
34 for i in domain_name ip_address serial ; do
35 eval "sedexpr=\"$sedexpr|sed 's/{$i}/\${$i}/g'\""
38 if [ "$sys_simple_dns" = "false" ]; then
39 echo "Creating /var/lib/gforge/bind/dns.head"
40 eval "cat /var/lib/gforge/bind/dns.head.template $sedexpr > /var/lib/gforge/bind/dns.head"
41 cp /var/lib/gforge/bind/dns.head /var/lib/gforge/bind/dns.zone
42 chown -R gforge:gforge /var/lib/gforge/bind
44 /usr/share/gforge/bin/dns_conf.pl
46 [ -f /var/lib/gforge/bind/dns.head ] && echo "Removing /var/lib/gforge/bind/dns.head" && \
47 rm /var/lib/gforge/bind/dns.head
48 echo "Creating /var/lib/gforge/bind/dns.zone"
49 eval "cat /var/lib/gforge/bind/dns.simple.template $sedexpr > /var/lib/gforge/bind/dns.zone"
52 echo "DNS Config is not complete:"
53 echo " -Does not do reverse, maybe not in the state of the art"
54 echo " -Suppose that all servers are in the same box"
55 echo " -Wizards advices are welcome"
57 /usr/sbin/invoke-rc.d bind9 restart
58 # This is equivalent but require some signature, not always there
59 # /usr/sbin/rndc reload
64 cp -a /etc/bind/named.conf /etc/bind/named.conf.gforge-new
65 if grep -q "// Next line inserted by GForge install" /etc/bind/named.conf.gforge-new ; then
66 perl -pi -e "s:zone.*gforge.*};\n::" /etc/bind/named.conf.gforge-new
67 perl -pi -e "s:// Next line inserted by GForge install\n::" /etc/bind/named.conf.gforge-new
71 /usr/sbin/invoke-rc.d bind9 restart
75 echo "Usage: $0 {configure|configure-files|purge|purge-files}"