bind2netbsd revision 1.5 1 #! /bin/sh
2 #
3 # $NetBSD: bind2netbsd,v 1.5 2019/11/27 05:48:39 christos Exp $
4 #
5 # Copyright (c) 2000 The NetBSD Foundation, Inc.
6 # All rights reserved.
7 #
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.
16 #
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.
28 #
29 # bind2netbsd: convert a bind tree into a
30 # netbsd bind source tree, under src/external/mpl/bind/dist,
31 # based on bind2netbsd by Bernd Ernesti and changes by Simon Burge
32 #
33 # Rough instructions for importing new bind release:
34 #
35 # $ cd /some/where/temporary
36 # $ tar xpfz /new/bind/release/tar/file
37 # $ sh /usr/src/external/mpl/bind/bind2netbsd bind-9.x.y `pwd`
38 # $ cd src/external/mpl/bind/dist
39 # $ cvs -d cvs.netbsd.org:/cvsroot import src/external/mpl/bind/dist ISC bind-9-x-y
40 # Enter the new CHANGES portion as your commit message
41 # $ cd ../../../../../bind-9.x.y
42 # $ run ./configure --enable-dnsrps --enable-querytrace --enable-fixed-rrset --without-python
43 # $ run make
44 # - use the binclude4netbsd to create and import the new headers in
45 # /usr/src/external/mpl/bind/include
46 # - check makefiles to see if any extra sources have been added.
47 # - update distrib/sets if necessary.
48 #
49 # Note that properly the import message should include a short summary
50 # of changes since the previous import rather than just "Import bind 9.x.y".
51 #
52
53 if [ $# -ne 2 ]; then echo "bind2netbsd src dest"; exit 1; fi
54
55 r=$1
56 d=$2/src/external/mpl/bind/dist
57
58 case "$d" in
59 /*)
60 ;;
61 *)
62 d=`/bin/pwd`/$d
63 ;;
64 esac
65
66 case "$r" in
67 /*)
68 ;;
69 *)
70 r=`/bin/pwd`/$r
71 ;;
72 esac
73
74 echo preparing directory $d
75 rm -rf $d
76 mkdir -p $d
77
78 ### Copy the files and directories
79 echo copying $r to $d
80 cd $r
81 pax -rw * $d
82
83 if [ -d $d/libtool.m4 ]
84 then
85 mv $d/libtool.m4 $d/m4
86 fi
87
88 ### Remove the $'s around RCS tags
89 cleantags $d
90
91 ### Add our NetBSD RCS Id
92 find $d -type f -name '*.[chly]' -print | while read c; do
93 sed 1q < $c | grep -q '\$NetBSD' || (
94 echo "/* \$NetBSD\$ */" >/tmp/bind3n$$
95 echo "" >>/tmp/bind3n$$
96 cat $c >> /tmp/bind3n$$
97 mv /tmp/bind3n$$ $c && echo added NetBSD RCS tag to $c
98 )
99 done
100
101 find $d -type f -name '*.[0-9]' -print | while read m; do
102 sed 1q < $m | grep -q '\$NetBSD' || (
103 echo ".\\\" \$NetBSD\$" >/tmp/bind2m$$
104 echo ".\\\"" >>/tmp/bind2m$$
105 cat $m >> /tmp/bind2m$$
106 mv /tmp/bind2m$$ $m && echo added NetBSD RCS tag to $m
107 )
108 done
109
110 find $d -type f -name '*.texi' -print | while read t; do
111 sed "2 s/^/@c \$NetBSD\$\\
112 /" < $t > /tmp/bind4t$$
113 mv /tmp/bind4t$$ $t && echo added NetBSD RCS tag to $t
114 done
115
116 echo done
117
118 ### Clean up any CVS directories that might be around.
119 echo "cleaning up CVS residue."
120 (
121 cd $d
122 find . -type d -name "CVS" -print | xargs rm -r
123 )
124 echo done
125
126 ### Fixing file and directory permissions.
127 echo "Fixing file/directory permissions."
128 (
129 cd $d
130 find . -type f -print | xargs chmod u+rw,go+r
131 find . -type d -print | xargs chmod u+rwx,go+rx
132 )
133 echo done
134
135 exit 0
136