Added config file. Primary is extra config item now.
authorHeiko Schlittermann <hs@schlittermann.de>
Tue, 29 Jun 2010 09:54:44 +0200
changeset 7 9cad6f1c5505
parent 6 920c1a51ba0e
child 8 a1eefce2bd5e
Added config file. Primary is extra config item now.
dnstools.conf
mkdomain
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dnstools.conf	Tue Jun 29 09:54:44 2010 +0200
@@ -0,0 +1,6 @@
+SECONDARY=hh.schlittermann.de
+PRIMARY=pu.schlittermann.de
+THIS_HOST=
+THIS_IP=
+THIS_DOMAIN=
+
--- a/mkdomain	Mon Jun 28 18:02:04 2010 +0200
+++ b/mkdomain	Tue Jun 29 09:54:44 2010 +0200
@@ -17,11 +17,15 @@
 start=$(date -I)
 
 # config
+source dnstools.conf
 
-secondary=hh.schlittermann.de
-this_host=ns1.eins.lan #${this_host=$(hostname -f)}
-this_ip=192.168.0.1 #${this_ip=$(hostname -i)}
-this_domain=eins.lan #${this_domain=$(hostname -d)}
+secondary=$SECONDARY
+secondary_ip=${secondary_ip=$(dig +short $secondary)}
+
+this_host=${THIS_HOST:-$(hostname -f)}
+this_ip=${THIS_IP:-$(hostname -i)}
+this_domain=${THIS_DOMAIN:-$(hostname -d)}
+primary=${PRIMARY:-$this_host}
 
 hostmaster=${hostmaster="hostmaster.$this_domain"}
 
@@ -31,14 +35,13 @@
 test -d $primary_dir || mkdir $primary_dir
 test -d $master_dir || mkdir $master_dir
 
-secondary=${secondary?}
-secondary_ip=${secondary_ip=$(dig +short $secondary)}
 
 # debug option
 if test $opt_debug; then
 	cat <<xxx
 this host:		$this_host [$this_ip]
 this domain:		$this_domain
+primary:		$primary
 secondary:		$secondary [$secondary_ip]
 hostmaster:		$hostmaster
 primary directory:	$primary_dir
@@ -74,7 +77,7 @@
 		IN TXT		"start: $start"
 		IN TXT		"utf8: $utf8domain"
 
-		IN NS		$this_host.
+		IN NS		$primary.
 		IN NS		$secondary.
 
 xxx