fixes for ns3 and ns4 support

This commit is contained in:
Serghey Rodin 2013-05-14 16:18:19 +03:00
commit 11eef69dda
4 changed files with 42 additions and 26 deletions

View file

@ -83,8 +83,19 @@ soa="$ns1"
exp=$(date +%F -d "+ 1 year")
ttl=14400
# Adding zone to dns dir
cat $DNSTPL/$template.tpl |\
# Reading template
template_data=$(cat $DNSTPL/$template.tpl)
# Deleting unused nameservers
if [ -z "$ns3" ]; then
template_data=$(echo "$template_data" | grep -v %ns3%)
fi
if [ -z "$ns4" ]; then
template_data=$(echo "$template_data" | grep -v %ns4%)
fi
# Add dns zone to the user config
echo "$template_data" |\
sed -e "s/%ip%/$ip/g" \
-e "s/%domain_idn%/$domain_idn/g" \
-e "s/%domain%/$domain/g" \
@ -94,6 +105,7 @@ cat $DNSTPL/$template.tpl |\
-e "s/%ns4%/$ns4/g" \
-e "s/%time%/$TIME/g" \
-e "s/%date%/$DATE/g" > $USER_DATA/dns/$domain.conf
chmod 660 $USER_DATA/dns/$domain.conf
records="$(wc -l $USER_DATA/dns/$domain.conf |cut -f 1 -d ' ')"