3 # $NetBSD: ipf2netbsd,v 1.21 2008/04/30 13:10:47 martin Exp $
5 # Copyright (c) 1999 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 # ipf2netbsd: convert a ipf source tree into a netbsd ipf source tree,
30 # under src/dist/ipf, src/sys/dist/ipf/netinet, src/sys/lkm/netinet/if_ipl
31 # and src/regress/sys/kern/ipf
33 if [ $# -ne 2 ]; then echo "ipf2netbsd src dest"; exit 1; fi
46 dbase
=$dest/src
/dist
/ipf
47 dsys
=$dest/src
/sys
/dist
/ipf
/netinet
48 dlkm
=$dest/src
/sys
/lkm
/netinet
/if_ipl
49 dregress
=$dest/src
/regress
/sys
/kern
/ipf
59 echo preparing directory
$dbase, $dsys, $dlkm and
$dregress
60 rm -rf $dbase $dsys $dlkm $dregress
62 ### Copy the files and directories
63 mkdir
-p $dbase $dsys $dlkm $dregress
103 pax
-rvw mln_ipl.c
$dlkm
107 ### Remove uninteresting bits
108 echo "removing extraneous files and directiones."
110 cd ${dest}/src
/dist
/ipf
111 find .
-name .cvsignore |
xargs /bin
/rm -f
112 for i
in 4bsd AIX BSD BSDOS BSDOS3 BSDOS4 COMPILE
.2.5 COMPILE.Solaris2 \
113 FAQ.FreeBSD FreeBSD FreeBSD-2.2 FreeBSD-3 FreeBSD-4.0 HPUX \
114 INST.FreeBSD-2.2 INSTALL.BSDOS INSTALL.FreeBSD INSTALL.IRIX \
115 INSTALL.Sol2 INSTALL.SunOS INSTALL.Tru64 Linux IRIX OSF \
116 INSTALL.NetBSD INSTALL.Linux INSTALL.xBSD INSTALL.BSDOS3 NAT.FreeBSD OpenBSD OpenBSD-2 OpenBSD-3 SunOS4 SunOS5 ipsend
/.OLD
; do
123 ### Remove the $'s around various RCSIDs
124 find $dest -type f
-print |
while read f
; do
125 sed -e 's/\$\(Id.*\) \$/\1/' \
126 -e 's/\$\(Header.*\) \$/\1/' \
127 $f > /tmp
/ipf2f$$
&& mv /tmp
/ipf2f$$
$f && \
128 echo removed RCS tag from
$f
131 ### Add our NetBSD RCS Id
132 find $dest -type f
-name '*.[chly]' -print |
while read c
; do
133 sed 1q
< $c |
grep -q '\$NetBSD' ||
(
134 echo "/* \$NetBSD\$ */" >/tmp
/ipf2n$$
135 echo "" >>/tmp
/ipf2n$$
136 cat $c >> /tmp
/ipf2n$$
137 mv /tmp
/ipf2n$$
$c && echo added RCS tag to
$c
141 find $dest -type f
-name '*.[0-9]' -a \
! -name 'example.*' -a \
! -name 'ipv6.*' -print |
while read m
; do
142 sed 1q
< $m |
grep -q '\$NetBSD' ||
(
143 echo ".\\\" \$NetBSD\$" >/tmp
/ipf2m$$
144 echo ".\\\"" >>/tmp
/ipf2m$$
145 cat $m >> /tmp
/ipf2m$$
146 mv /tmp
/ipf2m$$
$m && echo added RCS tag to
$m
150 find $dest -type f
-name 'example.*' -print |
while read e
; do
151 sed 1q
< $e |
grep -q '\$NetBSD' ||
(
152 echo "# \$NetBSD\$" >/tmp
/ipf2e$$
153 cat $e >> /tmp
/ipf2e$$
154 mv /tmp
/ipf2e$$
$e && echo added RCS tag to
$e
160 ### Clean up any CVS directories that might be around.
161 echo "cleaning up CVS residue."
164 find .
-type d
-name "CVS" -print |
xargs rm -r
168 ### Fixing file and directory permissions.
169 echo "Fixing file/directory permissions."
172 find .
-type f
-print |
xargs chmod u
+rw
,go
+r
173 find .
-type d
-print |
xargs chmod u
+rwx
,go
+rx