First version. This makes it easier to import a newer version of bind

under basesrc/usr.sbin/bind.
This commit is contained in:
veego 1999-11-12 23:58:56 +00:00
parent 6b99f559fd
commit 31806433e4

163
dist/bind/bind2netbsd vendored Executable file
View File

@ -0,0 +1,163 @@
#! /bin/sh
#
# $NetBSD: bind2netbsd,v 1.1 1999/11/12 23:58:56 veego Exp $
#
# Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
# All rights reserved.
#
# 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
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by the NetBSD
# Foundation, Inc. and its contributors.
# 4. Neither the name of The NetBSD Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# 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.
#
# bind2netbsd: convert a bind source tree into a
# netbsd bind source tree, under basesrc/dist,
# Note: you need to extract the src and doc tar files and put it into
# one directory. This directory is the 'src' argument of bind2netbsd.
if [ $# -ne 2 ]; then echo "bind2netbsd src dest"; exit 1; fi
r=$1
d=$2/basesrc/dist/bind
case "$d" in
/*)
;;
*)
d=`/bin/pwd`/$d
;;
esac
case "$r" in
/*)
;;
*)
r=`/bin/pwd`/$r
;;
esac
echo preparing directory $d
rm -rf $d
mkdir -p $d; cd $d
mkdir -p man reload restart
cd $r/src
pax -rvw bin include lib $d
cd port/netbsd/include
pax -rvw port_after.h port_before.h $d/include
cd $r/doc/man
pax -rvw dig.1 dnskeygen.1 dnsquery.1 host.1 named-bootconf.8 named-xfer.8 named.8 named.conf.5 ndc.8 nslookup.8 $d/man
### Remoce .cvsignore and Makefiles files
find $d -name '.cvsignore' -exec rm {} \;
find $d -name 'Makefile' -exec rm {} \;
cd $d/lib/isc && rm *.mdoc
### Create named.reload.sh
cd $d/reload
cat > named.reload.sh<<'__eof_reload'
# $NetBSD: bind2netbsd,v 1.1 1999/11/12 23:58:56 veego Exp $
#
# from named.reload 5.2 (Berkeley) 6/27/89
# from: Id: named.reload.sh,v 8.1 1994/12/15 06:24:14 vixie Exp
#
exec /usr/sbin/ndc reload
__eof_reload
### Create named.restart.sh
cd $d/restart
cat > named.reload.sh<<'__eof_restart'
# $NetBSD: bind2netbsd,v 1.1 1999/11/12 23:58:56 veego Exp $
#
# from named.restart 5.2 (Berkeley) 6/27/89
# from: Id: named.restart.sh,v 8.1 1994/12/15 06:24:14 vixie Exp
#
exec /usr/sbin/ndc restart
__eof_restart
### Remove the $'s around the Id: and add our $NetBSD: bind2netbsd,v 1.1 1999/11/12 23:58:56 veego Exp $
find $d -name '*.[chly]' -print | while read c; do
sed -e ' s/\$\(Id.*\) \$/\1/' < $c > /tmp/bind2n$$ && mv /tmp/bind2n$$ $c && \
echo removed \$Id tag from $c
sed 1q < $c | grep -q '\$NetBSD' || (
cat <<'__eof_header' > /tmp/bind3n$$
/* $NetBSD: bind2netbsd,v 1.1 1999/11/12 23:58:56 veego Exp $ */
__eof_header
cat $c >> /tmp/bind3n$$
mv /tmp/bind3n$$ $c && echo added RCS tag to $c
)
done
find $d/man -name '*.[0-9]' -print | while read m; do
sed -e ' s/\$\(Id.*\) \$/\1/' < $m > /tmp/bind1m$$ && \
mv /tmp/bind1m$$ $m && echo removed \$Id tag from $m
sed 1q < $m | grep -q '\$NetBSD' || (
cat <<'__eof_header' > /tmp/bind2m$$
.\" $NetBSD: bind2netbsd,v 1.1 1999/11/12 23:58:56 veego Exp $
.\"
__eof_header
cat $m >> /tmp/bind2m$$
mv /tmp/bind2m$$ $m && echo added RCS tag to $m
sed -e "s/@INDOT@//g" -e "s/@INDOT_U@//g" \
-e "s/@XFER_INDOT@//g" -e "s/@XFER_INDOT_U@//g" \
-e "s/@CMD_EXT@/1/g" -e "s/@CMD_EXT_U@/1/g" \
-e "s/@LIB_NETWORK_EXT@/3/g" -e "s/@LIB_NETWORK_EXT_U@/3/g" \
-e "s/@FORMAT_EXT@/5/g" -e "s/@FORMAT_EXT_U@/5/g" \
-e "s/@DESC_EXT@/7/g" -e "s/@DESC_EXT_U@/7/g" \
-e "s/@SYS_OPS_EXT@/8/g" -e "s/@SYS_OPS_EXT_U@/8/g" \
-e "s/@SYSCALL_EXT@/2/g" -e "s/@SYSCALL_EXT_U@/2/g" \
-e "s/@BSD_SYSCALL_EXT@/2/g" -e "s/@BSD_SYSCALL_EXT_U@/2/g" \
-e "s/@LIB_C_EXT@/3/g" -e "s/@LIB_C_EXT_U@/3/g" < $m > /tmp/bind3m$$ && \
mv /tmp/bind3m$$ $m && echo fixup $m
)
done
echo done
### Clean up any CVS directories that might be around.
echo "cleaning up CVS residue."
(
cd $d
find . -type d -name "CVS" -print | xargs rm -r
)
echo done
### Fixing file and directory permissions.
echo "Fixing file/directory permissions."
(
cd $d
find . -type f -print | xargs chmod u+rw,go+r
find . -type d -print | xargs chmod u+rwx,go+rx
)
echo done
exit 0