10 if test $# -lt 2; then  | 
    10 if test $# -lt 2; then  | 
    11 	echo "usage: $0 kundennummer domain..." >&2  | 
    11 	echo "usage: $0 kundennummer domain..." >&2  | 
    12 	exit  | 
    12 	exit  | 
    13 fi  | 
    13 fi  | 
    14   | 
    14   | 
    15   | 
         | 
    16 customer="$1"; shift  | 
    15 customer="$1"; shift  | 
    17 start=$(date -I)  | 
    16 start=$(date -I)  | 
    18   | 
    17   | 
    19 # config  | 
    18 # config  | 
    20 source dnstools.conf  | 
    19 source dnstools.conf  | 
    21   | 
    20   | 
    22 secondary=$SECONDARY  | 
    21 secondary=$SECONDARY  | 
    23 secondary_ip=${secondary_ip=$(dig +short $secondary)} | 
    22 secondary_ip=${SECONDARY_IP:-$(dig +short $secondary)} | 
    24   | 
    23   | 
    25 this_host=${THIS_HOST:-$(hostname -f)} | 
    24 this_host=${THIS_HOST:-$(hostname -f)} | 
    26 this_ip=${THIS_IP:-$(hostname -i)} | 
    25 this_ip=${THIS_IP:-$(hostname -i)} | 
    27 this_domain=${THIS_DOMAIN:-$(hostname -d)} | 
    26 this_domain=${THIS_DOMAIN:-$(hostname -d)} | 
    28 primary=${PRIMARY:-$this_host} | 
    27 primary=${PRIMARY:-$this_host} | 
    29   | 
    28   | 
    30 hostmaster=${hostmaster="hostmaster.$this_domain"} | 
    29 hostmaster=${HOSTMASTER:-"hostmaster.$this_domain"} | 
    31   | 
    30   | 
    32 primary_dir=${primary_dir=/etc/bind/zones.d} | 
    31 zone_conf_dir=${ZONE_CONF_DIR:-/etc/bind/zones.d} | 
    33 master_dir=${master_dir=/etc/bind/master} | 
    32 master_dir=${MASTER_DIR:-/etc/bind/master} | 
    34   | 
    33   | 
    35 test -d $primary_dir || mkdir $primary_dir  | 
    34 if [ ! -d $master_dir ]  | 
    36 test -d $master_dir || mkdir $master_dir  | 
    35 then  | 
         | 
    36 	echo $master_dir nicht gefunden  | 
         | 
    37 	exit 1  | 
         | 
    38 fi  | 
    37   | 
    39   | 
         | 
    40 if [ ! -d $zone_conf_dir ]  | 
         | 
    41 then  | 
         | 
    42 	echo $zone_conf_dir nicht gefunden  | 
         | 
    43 	exit 1  | 
         | 
    44 fi  | 
    38   | 
    45   | 
    39 # debug option  | 
    46 # debug option  | 
    40 if test $opt_debug; then  | 
    47 if test $opt_debug; then  | 
    41 	cat <<xxx  | 
    48 	cat <<xxx  | 
    42 this host:		$this_host [$this_ip]  | 
    49 this host:		$this_host [$this_ip]  | 
    43 this domain:		$this_domain  | 
    50 this domain:		$this_domain  | 
    44 primary:		$primary  | 
    51 primary:		$primary  | 
    45 secondary:		$secondary [$secondary_ip]  | 
    52 secondary:		$secondary [$secondary_ip]  | 
    46 hostmaster:		$hostmaster  | 
    53 hostmaster:		$hostmaster  | 
    47 primary directory:	$primary_dir  | 
    54 zone config directory:	$zone_conf_dir  | 
    48 xxx  | 
    55 xxx  | 
    49 	exit  | 
    56 	exit  | 
    50 fi  | 
    57 fi  | 
    51   | 
    58   | 
    52 for utf8domain in "$@"; do  | 
    59 for utf8domain in "$@"; do  | 
    53 	domain=$(idn --quiet "$utf8domain")  | 
    60 	domain=$(idn --quiet "$utf8domain")  | 
    54   | 
    61   | 
    55 	test -d $master_dir/$domain || mkdir $master_dir/$domain  | 
    62 	test -d $master_dir/$domain || mkdir $master_dir/$domain  | 
    56   | 
    63   | 
    57 	zonefile=$master_dir/$domain/$domain  | 
    64 	zonefile=$master_dir/$domain/$domain  | 
    58 	config=$primary_dir/$domain  | 
    65 	config=$zone_conf_dir/$domain  | 
    59   | 
    66   | 
    60 	echo "$domain ($utf8domain)"  | 
    67 	echo "$domain ($utf8domain)"  | 
    61   | 
    68   | 
    62 	test -f $zonefile && { echo "$zonefile exists. Skipping $domain" >&2; continue; } | 
    69 	test -f $zonefile && { echo "$zonefile exists. Skipping $domain" >&2; continue; } | 
    63 	test -f $config && { echo "$config exists. Skipping $domain" >&2; continue; } | 
    70 	test -f $config && { echo "$config exists. Skipping $domain" >&2; continue; } |