xref: /netbsd-src/external/bsd/tcpdump/tcpdump2netbsd (revision 5b28f239895d55856221c590945769250e289f5f)
10e9868baSchristos#! /bin/sh
20e9868baSchristos#
3*5b28f239Srillig#	$NetBSD: tcpdump2netbsd,v 1.5 2024/09/08 09:36:46 rillig Exp $
40e9868baSchristos#
50e9868baSchristos# Copyright (c) 2000 The NetBSD Foundation, Inc.
60e9868baSchristos# All rights reserved.
70e9868baSchristos#
80e9868baSchristos# Redistribution and use in source and binary forms, with or without
90e9868baSchristos# modification, are permitted provided that the following conditions
100e9868baSchristos# are met:
110e9868baSchristos# 1. Redistributions of source code must retain the above copyright
120e9868baSchristos#    notice, this list of conditions and the following disclaimer.
130e9868baSchristos# 2. Redistributions in binary form must reproduce the above copyright
140e9868baSchristos#    notice, this list of conditions and the following disclaimer in the
150e9868baSchristos#    documentation and/or other materials provided with the distribution.
160e9868baSchristos#
170e9868baSchristos# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
180e9868baSchristos# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
190e9868baSchristos# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
200e9868baSchristos# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
210e9868baSchristos# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
220e9868baSchristos# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
230e9868baSchristos# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
240e9868baSchristos# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
250e9868baSchristos# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
260e9868baSchristos# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
270e9868baSchristos# POSSIBILITY OF SUCH DAMAGE.
280e9868baSchristos#
29*5b28f239Srillig# tcpdump2netbsd:  convert a tcpdump source tree into a
306b9fe8afSsimonb# netbsd tcpdump source tree, under src/dist,
310e9868baSchristos# based on bind2netbsd by Bernd Ernesti and changes by Simon Burge
320e9868baSchristos#
336b9fe8afSsimonb# Rough instructions for importing new tcpdump release:
340e9868baSchristos#
350e9868baSchristos#	$ cd /some/where/temporary
366b9fe8afSsimonb#	$ tar xpfz /new/tcpdump/release/tar/file
3772c96ff3Schristos#	$ sh /usr/src/external/bsd/tcpdump/dist/tcpdump2netbsd tcpdump-x.y.z
38817e9a7eSchristos#	$ cd src/external/bsd/tcpdump
39817e9a7eSchristos#	$ cvs -d cvs.netbsd.org:/cvsroot import -m "Import tcpdump x.y.z" src/external/bsd/tcpdump/dist TCPDUMP tcpdump-x-y-z
400e9868baSchristos#	$ cd ../../../tcpdump-x.y.z
410e9868baSchristos#	$ run ./configure
420e9868baSchristos# copy newly generated config.h with /usr/src/external/bsd/tcpdump/include/config.h
430e9868baSchristos#	- check makefiles to see if any extra sources have been added.
440e9868baSchristos#	- update distrib/sets if necessary.
450e9868baSchristos
460e9868baSchristosif [ $# -ne 1 ]; then echo "tcpdump2netbsd src"; exit 1; fi
470e9868baSchristos
480e9868baSchristosr=$1
490e9868baSchristos
500e9868baSchristoscase "$d" in
510e9868baSchristos	/*)
520e9868baSchristos		;;
530e9868baSchristos	*)
540e9868baSchristos		d=`/bin/pwd`/$d
550e9868baSchristos		;;
560e9868baSchristosesac
570e9868baSchristos
580e9868baSchristoscase "$r" in
590e9868baSchristos	/*)
600e9868baSchristos		;;
610e9868baSchristos	*)
620e9868baSchristos		r=`/bin/pwd`/$r
630e9868baSchristos		;;
640e9868baSchristosesac
650e9868baSchristos
660e9868baSchristos### Remove the $'s around RCS tags
670e9868baSchristoscleantags $r
680e9868baSchristos
690e9868baSchristos### Clean up any CVS directories that might be around.
700e9868baSchristosecho "cleaning up CVS residue."
710e9868baSchristos(
720e9868baSchristos	cd $r
730e9868baSchristos	find . -type d -name "CVS" -print | xargs rm -r
740e9868baSchristos)
750e9868baSchristosecho done
760e9868baSchristos
770e9868baSchristos### Fixing file and directory permissions.
780e9868baSchristosecho "Fixing file/directory permissions."
790e9868baSchristos(
800e9868baSchristos	cd $r
810e9868baSchristos	find . -type f -print | xargs chmod u+rw,go+r
820e9868baSchristos	find . -type d -print | xargs chmod u+rwx,go+rx
830e9868baSchristos)
840e9868baSchristosecho done
850e9868baSchristos
860e9868baSchristosexit 0
87