3 # $NetBSD: pf2netbsd,v 1.1 2009/12/01 06:27:57 martti Exp $
5 # Copyright (c) 2009 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.
34 Usage: `basename $0` [options] srcdir dstdir
43 `basename $0` /tmp/openbsd-4.2 /tmp/netbsd-4.2
60 echo "ERROR: Not enough arguments for mklist!"
66 libexec/tftp-proxy/filter.c
67 libexec/tftp-proxy/filter.h
68 libexec/tftp-proxy/Makefile
69 libexec/tftp-proxy/tftp-proxy.8
70 libexec/tftp-proxy/tftp-proxy.c
74 sbin/pfctl/pfctl_altq.c
77 sbin/pfctl/pfctl_optimize.c
78 sbin/pfctl/pfctl_osfp.c
79 sbin/pfctl/pfctl_parser.c
80 sbin/pfctl/pfctl_parser.h
81 sbin/pfctl/pfctl_qstats.c
82 sbin/pfctl/pfctl_radix.c
83 sbin/pfctl/pfctl_table.c
84 sbin/pfctl/pf_print_state.c
90 sbin/pflogd/privsep_fdpass.c
92 share/man/man4/pflog.4
93 share/man/man4/pfsync.4
94 share/man/man5/pf.conf.5
95 share/man/man5/pf.os.5
96 usr.sbin/authpf/authpf.8
97 usr.sbin/authpf/authpf.c
98 usr.sbin/authpf/Makefile
99 usr.sbin/authpf/pathnames.h
100 usr.sbin/ftp-proxy/filter.c
101 usr.sbin/ftp-proxy/filter.h
102 usr.sbin/ftp-proxy/ftp-proxy.8
103 usr.sbin/ftp-proxy/ftp-proxy.c
104 usr.sbin/ftp-proxy/Makefile
119 sys/netinet/tcp_subr.c
120 sys/netinet/tcp_var.h
130 echo "ERROR: Not enough arguments for openbsd2netbsd!"
133 if [ -d $2/dist
/pf
]; then
134 echo "ERROR: $2 already exists!"
137 if [ -d "$1/src" ]; then
138 echo "ERROR: Use $1/src as the srcdir!"
145 verbose
"mklist /tmp/pf.$$"
146 verbose
"mkdir -p $2"
147 verbose
"tar -c -T /tmp/pf.$$ -f- | tar -x -f- -C $2"
149 # Some files have different name/location in NetBSD
151 verbose mkdir
-p dist
/pf sys
/dist
/pf
153 verbose
cd $2/sys
/net
154 verbose
mv if.c if_compat.c
155 verbose
mv if.h if_compat.h
156 verbose
cp pf.c pf_mtag.c
157 verbose
cp pfvar.h pf_mtag.h
159 verbose
cd $2/sys
/netinet
160 verbose
mv tcp_subr.c tcp_rndiss.c
161 verbose
mv tcp_var.h tcp_rndiss.h
164 verbose
mv etc libexec sbin share usr.sbin dist
/pf
/
167 verbose
mv net netinet dist
/pf
/
169 # Remove references to the OpenBSD CVS
170 find $2 -name CVS |
xargs rm -rf
172 # # Remove the $'s around various CVS keywords
173 # find $2 -type f | \
176 # sed -e 's/\$\(Id.*\) \$/\1/' \
177 # -e 's/\$\(Date.*\) \$/\1/' \
178 # -e 's/\$\(Header.*\) \$/\1/' \
181 # echo "Deactivated CVS keywords from ${f}"
184 # Add the NetBSD keyword
185 find $2 -type f
-name '*.[chly]' | \
186 grep -v -e if_compat
-e tcp_rndiss | \
189 sed 1q
< ${f} |
grep -q '\$NetBSD' ||
(
190 cat > /tmp
/pf2n.$$
<< EOF
193 cat ${f} >> /tmp
/pf2n.$$
197 find $2 -type f
-name '*.[0-9]' | \
200 sed 1q
< ${f} |
grep -q '\$NetBSD' ||
(
201 cat > /tmp
/pf2n.$$
<< EOF
204 cat ${f} >> /tmp
/pf2n.$$
208 find $2 -type f
-name 'faq*' -o -name 'queue*' \
209 -o -name 'ackpri' -o -name 'spamd' | \
212 sed 1q
< ${f} |
grep -q '\$NetBSD' ||
(
213 cat > /tmp
/pf2n.$$
<< EOF
216 cat ${f} >> /tmp
/pf2n.$$
220 find $2 -type f
-name 'Makefile' | \
223 sed 1q
< ${f} |
grep -q '\$NetBSD' ||
(
224 cat > /tmp
/pf2n.$$
<< EOF
227 cat ${f} >> /tmp
/pf2n.$$
238 ARGV
=`getopt hv ${*}`
239 [ ${?} != 0 ] && exit 1
257 [ $# -ne 2 ] && usage
262 echo "The sources-to-be-imported are now in $2"