3 # $NetBSD: bind2netbsd,v 1.2 2009/04/12 15:05:59 christos Exp $
5 # Copyright (c) 2000 The NetBSD Foundation, Inc.
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
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 # bind2netbsd: convert a bind tree into a
30 # netbsd bind source tree, under src/external/bsd/bind/dist,
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/bind/dist/bind2netbsd bind-9.x.y `pwd`
38 # $ cd src/external/bsd/bind/dist
39 # $ cvs import -m "Import bind 9.x.y" src/external/bsd/bind/dist ISC bind-9-x-y
40 # $ cd ../../../../../bind-9.x.y
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
51 d
=$2/src
/external
/bsd
/bind
/dist
69 echo preparing directory
$d
73 ### Copy the files and directories
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
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
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
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
115 ### Clean up any CVS directories that might be around.
116 echo "cleaning up CVS residue."
119 find .
-type d
-name "CVS" -print |
xargs rm -r
123 ### Fixing file and directory permissions.
124 echo "Fixing file/directory permissions."
127 find .
-type f
-print |
xargs chmod u
+rw
,go
+r
128 find .
-type d
-print |
xargs chmod u
+rwx
,go
+rx