named-bootconf.sh revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
#
# Portions Copyright (C) 1999-2001, 2004, 2006, 2007, 2012, 2014, 2016 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# $Id: named-bootconf.sh,v 1.12 2007/06/19 23:47:07 tbox Exp $
# $NetBSD: named-bootconf.sh,v 1.5 1998/12/15 01:00:53 tron Exp $
#
# Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by Matthias Scheler.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
if [ ${OPTIONFILE-X} = X ]; then
exit 1
}
DUMP=1
else
DUMP=0
fi
\; )
echo \# $ARGS >>$COMMENTFILE
;;
cache )
set - X $ARGS
shift
if [ $# -eq 2 ]; then
(echo ""
echo "zone \"$1\" {"
echo " type hint;"
echo " file \"$2\";"
rm -f $COMMENTFILE
fi
;;
set - X $ARGS
shift
if [ $# -eq 1 ]; then
rm -f $COMMENTFILE
DIRECTORY=$1
export DIRECTORY
fi
;;
echo " forwarders {"
echo " $ARG;"
done
rm -f $COMMENTFILE
;;
include )
if [ "$ARGS" != "" ]; then
fi
;;
limit )
set - X $ARGS
shift
if [ $# -eq 2 ]; then
case $1 in
echo " $1 $2;" >>$OPTIONFILE
;;
esac
rm -f $COMMENTFILE
fi
;;
options )
echo " fake-iquery yes;" >>$OPTIONFILE
;;
echo " forward only;" >>$OPTIONFILE
;;
echo " fetch-glue no;" >>$OPTIONFILE
;;
echo " recursion no;" >>$OPTIONFILE
;;
esac
done
rm -f $COMMENTFILE
;;
class="chaos "
;;
class="hesiod "
;;
esac
set - X $ARGS
shift
if [ $# -eq 2 ]; then
(echo ""
echo "zone \"$1\" ${class}{"
echo " type master;"
echo " file \"$2\";"
rm -f $COMMENTFILE
fi
;;
class="chaos "
;;
class="hesiod "
;;
esac
set - X $ARGS
shift
if [ $# -gt 2 ]; then
ZONE=$1
shift
PRIMARIES=$1
while [ $# -gt 2 ]; do
shift
PRIMARIES="$PRIMARIES $1"
done
(echo ""
echo "zone \"$ZONE\" ${class}{"
echo " type slave;"
echo " file \"$2\";"
echo " masters {"
for PRIMARY in $PRIMARIES; do
echo " $PRIMARY;"
done
echo " };"
rm -f $COMMENTFILE
fi
;;
class="chaos "
;;
class="hesiod "
;;
esac
set - X $ARGS
shift
if [ $# -gt 2 ]; then
ZONE=$1
shift
PRIMARIES=$1
while [ $# -gt 2 ]; do
shift
PRIMARIES="$PRIMARIES $1"
done
(echo ""
echo "zone \"$ZONE\" ${class}{"
echo " type stub;"
echo " file \"$2\";"
echo " masters {"
for PRIMARY in $PRIMARIES; do
echo " $PRIMARY;"
done
echo " };"
rm -f $COMMENTFILE
fi
;;
slave )
echo " forward only;" >>$OPTIONFILE
rm -f $COMMENTFILE
;;
sortlist )
echo " topology {"
*.0.0.0 )
echo " $ARG/8;"
;;
*.0.0 )
echo " $ARG/16;"
;;
*.0 )
echo " $ARG/24;"
;;
* )
echo " $ARG;"
;;
esac
done
echo " };") >>$OPTIONFILE
rm -f $COMMENTFILE
;;
echo " allow-transfer {"
*.0.0.0 )
echo " $ARG/8;"
;;
*.0.0 )
echo " $ARG/16;"
;;
*.0 )
echo " $ARG/24;"
;;
* )
echo " $ARG;"
;;
esac
done
echo " };") >>$OPTIONFILE
rm -f $COMMENTFILE
;;
esac
done
echo ""
echo "options {"
echo "};"
fi
exit 0