* use better method to write comments to the correct location
* always create an "option" section because "named" will complain otherwise * don't check if directory exists while converting a "directory" statement because we might do it on another machine
This commit is contained in:
parent
cb022e620d
commit
572fc80939
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# $NetBSD: named-bootconf.sh,v 1.4 1998/12/14 15:39:12 lukem Exp $
|
# $NetBSD: named-bootconf.sh,v 1.5 1998/12/15 01:00:53 tron Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
|
# Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
@ -39,8 +39,9 @@
|
|||||||
if [ ${OPTIONFILE-X} = X ]; then
|
if [ ${OPTIONFILE-X} = X ]; then
|
||||||
OPTIONFILE=/tmp/.options.`date +%s`.$$
|
OPTIONFILE=/tmp/.options.`date +%s`.$$
|
||||||
ZONEFILE=/tmp/.zones.`date +%s`.$$
|
ZONEFILE=/tmp/.zones.`date +%s`.$$
|
||||||
export OPTIONFILE ZONEFILE
|
COMMENTFILE=/tmp/.comments.`date +%s`.$$
|
||||||
touch $OPTIONFILE $ZONEFILE
|
export OPTIONFILE ZONEFILE COMMENTFILE
|
||||||
|
touch $OPTIONFILE $ZONEFILE $COMMENTFILE
|
||||||
DUMP=1
|
DUMP=1
|
||||||
else
|
else
|
||||||
DUMP=0
|
DUMP=0
|
||||||
@ -49,34 +50,44 @@ fi
|
|||||||
while read CMD ARGS; do
|
while read CMD ARGS; do
|
||||||
case $CMD in
|
case $CMD in
|
||||||
\; )
|
\; )
|
||||||
echo \# $ARGS
|
echo \# $ARGS >>$COMMENTFILE
|
||||||
;;
|
;;
|
||||||
cache )
|
cache )
|
||||||
set - X $ARGS
|
set - X $ARGS
|
||||||
shift
|
shift
|
||||||
if [ $# -eq 2 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
(echo ""
|
(echo ""
|
||||||
|
cat $COMMENTFILE
|
||||||
echo "zone \"$1\" {"
|
echo "zone \"$1\" {"
|
||||||
echo " type hint;"
|
echo " type hint;"
|
||||||
echo " file \"$2\";"
|
echo " file \"$2\";"
|
||||||
echo "};") >>$ZONEFILE
|
echo "};") >>$ZONEFILE
|
||||||
|
rm -f $COMMENTFILE
|
||||||
|
touch $COMMENTFILE
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
directory )
|
directory )
|
||||||
set - X $ARGS
|
set - X $ARGS
|
||||||
shift
|
shift
|
||||||
if [ $# -eq 1 -a -d $1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
echo " directory \"$1\";" >>$OPTIONFILE
|
(cat $COMMENTFILE
|
||||||
|
echo " directory \"$1\";") >>$OPTIONFILE
|
||||||
|
rm -f $COMMENTFILE
|
||||||
|
touch $COMMENTFILE
|
||||||
|
|
||||||
DIRECTORY=$1
|
DIRECTORY=$1
|
||||||
export DIRECTORY
|
export DIRECTORY
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
forwarders )
|
forwarders )
|
||||||
(echo " forwarders {"
|
(cat $COMMENTFILE
|
||||||
|
echo " forwarders {"
|
||||||
for ARG in $ARGS; do
|
for ARG in $ARGS; do
|
||||||
echo " $ARG;"
|
echo " $ARG;"
|
||||||
done
|
done
|
||||||
echo " };") >>$OPTIONFILE
|
echo " };") >>$OPTIONFILE
|
||||||
|
rm -f $COMMENTFILE
|
||||||
|
touch $COMMENTFILE
|
||||||
;;
|
;;
|
||||||
include )
|
include )
|
||||||
if [ "$ARGS" != "" ]; then
|
if [ "$ARGS" != "" ]; then
|
||||||
@ -87,14 +98,18 @@ while read CMD ARGS; do
|
|||||||
set - X $ARGS
|
set - X $ARGS
|
||||||
shift
|
shift
|
||||||
if [ $# -eq 2 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
|
cat $COMMENTFILE >>$OPTIONFILE
|
||||||
case $1 in
|
case $1 in
|
||||||
datasize | files | transfers-in | transfers-per-ns )
|
datasize | files | transfers-in | transfers-per-ns )
|
||||||
echo " $1 $2;" >>$OPTIONFILE
|
echo " $1 $2;" >>$OPTIONFILE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
rm -f $COMMENTFILE
|
||||||
|
touch $COMMENTFILE
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
options )
|
options )
|
||||||
|
cat $COMMENTFILE >>$OPTIONFILE
|
||||||
for ARG in $ARGS; do
|
for ARG in $ARGS; do
|
||||||
case $ARG in
|
case $ARG in
|
||||||
fake-iquery )
|
fake-iquery )
|
||||||
@ -111,6 +126,8 @@ while read CMD ARGS; do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
rm -f $COMMENTFILE
|
||||||
|
touch $COMMENTFILE
|
||||||
;;
|
;;
|
||||||
primary|primary/* )
|
primary|primary/* )
|
||||||
case $CMD in
|
case $CMD in
|
||||||
@ -125,10 +142,13 @@ while read CMD ARGS; do
|
|||||||
shift
|
shift
|
||||||
if [ $# -eq 2 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
(echo ""
|
(echo ""
|
||||||
|
cat $COMMENTFILE
|
||||||
echo "zone \"$1\" ${class}{"
|
echo "zone \"$1\" ${class}{"
|
||||||
echo " type master;"
|
echo " type master;"
|
||||||
echo " file \"$2\";"
|
echo " file \"$2\";"
|
||||||
echo "};") >>$ZONEFILE
|
echo "};") >>$ZONEFILE
|
||||||
|
rm -f $COMMENTFILE
|
||||||
|
touch $COMMENTFILE
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
secondary|secondary/* )
|
secondary|secondary/* )
|
||||||
@ -151,6 +171,7 @@ while read CMD ARGS; do
|
|||||||
PRIMARIES="$PRIMARIES $1"
|
PRIMARIES="$PRIMARIES $1"
|
||||||
done
|
done
|
||||||
(echo ""
|
(echo ""
|
||||||
|
cat $COMMENTFILE
|
||||||
echo "zone \"$ZONE\" ${class}{"
|
echo "zone \"$ZONE\" ${class}{"
|
||||||
echo " type slave;"
|
echo " type slave;"
|
||||||
echo " file \"$2\";"
|
echo " file \"$2\";"
|
||||||
@ -160,13 +181,19 @@ while read CMD ARGS; do
|
|||||||
done
|
done
|
||||||
echo " };"
|
echo " };"
|
||||||
echo "};") >>$ZONEFILE
|
echo "};") >>$ZONEFILE
|
||||||
|
rm -f $COMMENTFILE
|
||||||
|
touch $COMMENTFILE
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
slave )
|
slave )
|
||||||
|
cat $COMMENTFILE >>$OPTIONFILE
|
||||||
echo " forward only;" >>$OPTIONFILE
|
echo " forward only;" >>$OPTIONFILE
|
||||||
|
rm -f $COMMENTFILE
|
||||||
|
touch $COMMENTFILE
|
||||||
;;
|
;;
|
||||||
sortlist )
|
sortlist )
|
||||||
(echo " topology {"
|
(cat $COMMENTFILE
|
||||||
|
echo " topology {"
|
||||||
for ARG in $ARGS; do
|
for ARG in $ARGS; do
|
||||||
case $ARG in
|
case $ARG in
|
||||||
*.0.0.0 )
|
*.0.0.0 )
|
||||||
@ -184,9 +211,12 @@ while read CMD ARGS; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
echo " };") >>$OPTIONFILE
|
echo " };") >>$OPTIONFILE
|
||||||
|
rm -f $COMMENTFILE
|
||||||
|
touch $COMMENTFILE
|
||||||
;;
|
;;
|
||||||
tcplist | xfrnets )
|
tcplist | xfrnets )
|
||||||
(echo " allow-transfer {"
|
(cat $COMMENTFILE
|
||||||
|
echo " allow-transfer {"
|
||||||
for ARG in $ARGS; do
|
for ARG in $ARGS; do
|
||||||
case $ARG in
|
case $ARG in
|
||||||
*.0.0.0 )
|
*.0.0.0 )
|
||||||
@ -204,20 +234,20 @@ while read CMD ARGS; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
echo " };") >>$OPTIONFILE
|
echo " };") >>$OPTIONFILE
|
||||||
|
rm -f $COMMENTFILE
|
||||||
|
touch $COMMENTFILE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $DUMP -eq 1 ]; then
|
if [ $DUMP -eq 1 ]; then
|
||||||
if [ -s $OPTIONFILE ]; then
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "options {"
|
echo "options {"
|
||||||
cat $OPTIONFILE
|
cat $OPTIONFILE
|
||||||
echo "};"
|
echo "};"
|
||||||
fi
|
cat $ZONEFILE $COMMENTFILE
|
||||||
cat $ZONEFILE
|
|
||||||
|
|
||||||
rm -f $OPTIONFILE $ZONEFILE
|
rm -f $OPTIONFILE $ZONEFILE $COMMENTFILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user