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