Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / libbind / dist / libbind2netbsd
blobda88ac4187c5c64ba64b06421ea29929cfd61751
1 #! /bin/sh
3 # $NetBSD: bind2netbsd,v 1.2 2009/04/12 15:05:59 christos Exp $
5 # Copyright (c) 2000 The NetBSD Foundation, Inc.
6 # All rights reserved.
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
17 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 # POSSIBILITY OF SUCH DAMAGE.
29 # libbind2netbsd: convert abind tree into a
30 # netbsd libbind source tree, under src/external/bsd,
31 # based on bind2netbsd by Bernd Ernesti and changes by Simon Burge
33 # Rough instructions for importing new bind release:
35 # $ cd /some/where/temporary
36 # $ tar xpfz /new/bind/release/tar/file
37 # $ sh /usr/src/external/bsd/libbind/dist/libbind2netbsd libbind-6.x.y `pwd`
38 # $ cd src/external/bsd/libbind/dist
39 # $ cvs import -m "Import libbind 6.x.y" src/external/bsd/libbind/dist ISC libbind-6-x-y
40 # $ cd ../../../../../libbind-6.x.y
41 # $ run ./configure
42 # $ run make
43 # - use the binclude4netbsd to create and import the new headers in
44 # /usr/src/usr.sbin/bind/include
45 # - check makefiles to see if any extra sources have been added.
46 # - update distrib/sets if necessary.
48 if [ $# -ne 2 ]; then echo "bind2netbsd src dest"; exit 1; fi
50 r=$1
51 d=$2/src/external/bsd/libbind/dist
53 case "$d" in
54 /*)
57 d=`/bin/pwd`/$d
59 esac
61 case "$r" in
62 /*)
65 r=`/bin/pwd`/$r
67 esac
69 echo preparing directory $d
70 rm -rf $d
71 mkdir -p $d
73 ### Copy the files and directories
74 echo copying $r to $d
75 cd $r
76 pax -rw * $d
78 ### Remove the $'s around RCS tags
79 find $d -type f -print | xargs egrep -l '\$(Id|Created|Header|Revision)' | while read f; do
80 sed -e 's/\$\(Id.*\) \$/\1/' \
81 -e 's/\$\(Created.*\) \$/\1/' \
82 -e 's/\$\(Header.*\) \$/\1/' \
83 -e 's/\$\(Revision.*\) \$/\1/' \
84 < $f > /tmp/bind1f$$ && mv /tmp/bind1f$$ $f && \
85 echo removed \$RCS tag from $f
86 done
88 ### Add our NetBSD RCS Id
89 find $d -type f -name '*.[chly]' -print | while read c; do
90 sed 1q < $c | grep -q '\$NetBSD' || (
91 echo "/* \$NetBSD\$ */" >/tmp/bind3n$$
92 echo "" >>/tmp/bind3n$$
93 cat $c >> /tmp/bind3n$$
94 mv /tmp/bind3n$$ $c && echo added NetBSD RCS tag to $c
96 done
98 find $d -type f -name '*.[0-9]' -print | while read m; do
99 sed 1q < $m | grep -q '\$NetBSD' || (
100 echo ".\\\" \$NetBSD\$" >/tmp/bind2m$$
101 echo ".\\\"" >>/tmp/bind2m$$
102 cat $m >> /tmp/bind2m$$
103 mv /tmp/bind2m$$ $m && echo added NetBSD RCS tag to $m
105 done
107 find $d -type f -name '*.texi' -print | while read t; do
108 sed "2 s/^/@c \$NetBSD\$\\
109 /" < $t > /tmp/bind4t$$
110 mv /tmp/bind4t$$ $t && echo added NetBSD RCS tag to $t
111 done
113 echo done
115 ### Clean up any CVS directories that might be around.
116 echo "cleaning up CVS residue."
118 cd $d
119 find . -type d -name "CVS" -print | xargs rm -r
121 echo done
123 ### Fixing file and directory permissions.
124 echo "Fixing file/directory permissions."
126 cd $d
127 find . -type f -print | xargs chmod u+rw,go+r
128 find . -type d -print | xargs chmod u+rwx,go+rx
130 echo done
132 exit 0