3 # Portions Copyright (C) 2004, 2006, 2007, 2012, 2014 Internet Systems Consortium, Inc. ("ISC")
4 # Portions Copyright (C) 1999-2001 Internet Software Consortium.
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
18 # Id: named-bootconf.sh,v 1.12 2007/06/19 23:47:07 tbox Exp
20 # NetBSD: named-bootconf.sh,v 1.5 1998/12/15 01:00:53 tron Exp
22 # Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
23 # All rights reserved.
25 # This code is derived from software contributed to The NetBSD Foundation
26 # by Matthias Scheler.
28 # Redistribution and use in source and binary forms, with or without
29 # modification, are permitted provided that the following conditions
31 # 1. Redistributions of source code must retain the above copyright
32 # notice, this list of conditions and the following disclaimer.
33 # 2. Redistributions in binary form must reproduce the above copyright
34 # notice, this list of conditions and the following disclaimer in the
35 # documentation and/or other materials provided with the distribution.
37 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
38 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
39 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
40 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
41 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
43 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
44 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
45 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
47 # POSSIBILITY OF SUCH DAMAGE.
49 if [ ${OPTIONFILE-X} = X
]; then
50 WORKDIR
=/tmp
/`date +%s`.$$
51 ( umask 077 ; mkdir
$WORKDIR ) ||
{
52 echo "unable to create work directory '$WORKDIR'" >&2
55 OPTIONFILE
=$WORKDIR/options
56 ZONEFILE
=$WORKDIR/zones
57 COMMENTFILE
=$WORKDIR/comments
58 export OPTIONFILE ZONEFILE COMMENTFILE
59 touch $OPTIONFILE $ZONEFILE $COMMENTFILE
65 while read CMD ARGS
; do
67 CMD
=`echo "${CMD}" | tr '[A-Z]' '[a-z]'`
70 echo \
# $ARGS >>$COMMENTFILE
81 echo "};") >>$ZONEFILE
91 echo " directory \"$1\";") >>$OPTIONFILE
105 echo " };") >>$OPTIONFILE
110 if [ "$ARGS" != "" ]; then
111 (cd ${DIRECTORY-.}; cat $ARGS) |
$0
115 ARGS
=`echo "${ARGS}" | tr '[A-Z]' '[a-z]'`
118 if [ $# -eq 2 ]; then
119 cat $COMMENTFILE >>$OPTIONFILE
121 datasize | files | transfers-in | transfers-per-ns
)
122 echo " $1 $2;" >>$OPTIONFILE
130 ARGS
=`echo "${ARGS}" | tr '[A-Z]' '[a-z]'`
131 cat $COMMENTFILE >>$OPTIONFILE
135 echo " fake-iquery yes;" >>$OPTIONFILE
138 echo " forward only;" >>$OPTIONFILE
141 echo " fetch-glue no;" >>$OPTIONFILE
144 echo " recursion no;" >>$OPTIONFILE
162 if [ $# -eq 2 ]; then
165 echo "zone \"$1\" ${class}{"
168 echo "};") >>$ZONEFILE
173 secondary|secondary
/* )
184 if [ $# -gt 2 ]; then
188 while [ $# -gt 2 ]; do
190 PRIMARIES
="$PRIMARIES $1"
194 echo "zone \"$ZONE\" ${class}{"
198 for PRIMARY
in $PRIMARIES; do
202 echo "};") >>$ZONEFILE
218 if [ $# -gt 2 ]; then
222 while [ $# -gt 2 ]; do
224 PRIMARIES
="$PRIMARIES $1"
228 echo "zone \"$ZONE\" ${class}{"
232 for PRIMARY
in $PRIMARIES; do
236 echo "};") >>$ZONEFILE
242 cat $COMMENTFILE >>$OPTIONFILE
243 echo " forward only;" >>$OPTIONFILE
266 echo " };") >>$OPTIONFILE
272 echo " allow-transfer {"
289 echo " };") >>$OPTIONFILE
296 if [ $DUMP -eq 1 ]; then
301 cat $ZONEFILE $COMMENTFILE
303 rm -f $OPTIONFILE $ZONEFILE $COMMENTFILE