bktr2netbsd revision 1.7
11.1Swiz#! /bin/sh
21.1Swiz#
31.7Srillig#	$NetBSD: bktr2netbsd,v 1.7 2024/09/08 10:02:00 rillig Exp $
41.1Swiz#
51.4Swiz# Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
61.1Swiz# All rights reserved.
71.1Swiz#
81.1Swiz# Redistribution and use in source and binary forms, with or without
91.1Swiz# modification, are permitted provided that the following conditions
101.1Swiz# are met:
111.1Swiz# 1. Redistributions of source code must retain the above copyright
121.1Swiz#    notice, this list of conditions and the following disclaimer.
131.1Swiz# 2. Redistributions in binary form must reproduce the above copyright
141.1Swiz#    notice, this list of conditions and the following disclaimer in the
151.1Swiz#    documentation and/or other materials provided with the distribution.
161.1Swiz#
171.1Swiz# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
181.1Swiz# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
191.1Swiz# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
201.1Swiz# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
211.1Swiz# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
221.1Swiz# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
231.1Swiz# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
241.1Swiz# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
251.1Swiz# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
261.1Swiz# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
271.1Swiz# POSSIBILITY OF SUCH DAMAGE.
281.1Swiz#
291.7Srillig# bktr2netbsd:  convert sourceforge bktr source tree into
301.1Swiz# netbsd bktr source tree, under sys/dev/pci/bktr
311.4Swiz# originally based on bind2netbsd by Bernd Ernesti
321.1Swiz
331.1Swizif [ $# -ne 2 ]; then echo "bktr2netbsd src dest"; exit 1; fi
341.1Swiz
351.1Swizr=$1
361.1Swizd=$2/sys/dev/pci/bktr
371.1Swiz
381.1Swizcase "$d" in
391.1Swiz	/*)
401.1Swiz		;;
411.1Swiz	*)
421.1Swiz		d=`/bin/pwd`/$d
431.1Swiz		;;
441.1Swizesac
451.1Swiz
461.1Swizcase "$r" in
471.1Swiz	/*)
481.1Swiz		;;
491.1Swiz	*)
501.1Swiz		r=`/bin/pwd`/$r
511.1Swiz		;;
521.1Swizesac
531.1Swiz
541.1Swizecho preparing directory $d
551.1Swizrm -rf $d
561.1Swizmkdir -p $d
571.1Swiz
581.1Swiz### Copy the files
591.1Swizecho copying $r to $d
601.1Swizcd $r
611.1Swizpax -rw * $d
621.1Swiz
631.1Swizecho removing unneeded files
641.1Swiz
651.1Swiz### Remove unneeded files
661.1Swizcd $d
671.4Swizrm -f CHANGELOG.TXT README.* bktr_i2c.[ch]
681.1Swiz
691.1Swiz### Remove the $'s around RCS tags
701.4Swizfind $d -type f -print | xargs egrep -l '\$Id:' | while read f; do
711.5Sisaki	sed -e 's/\$\(Id:\)\(.*\) \$/SourceForge:\2/' \
721.1Swiz	    < $f > /tmp/bktr1f$$ && mv /tmp/bktr1f$$ $f && \
731.4Swiz	echo quoted \$RCS tag from $f
741.1Swizdone
751.1Swiz
761.1Swiz### create bt8xx.h from ioctl_meteor.h and ioctl_bt848.h
771.1Swizecho merging ioctl_meteor.h and ioctl_bt848.h to bt8xx.h
781.1Swizecho "/* This file is merged from ioctl_meteor.h and ioctl_bt848.h from FreeBSD. */" > bt8xx.h
791.1Swizecho "/* The copyright below only applies to the ioctl_meteor.h part of this file. */" >> bt8xx.h
801.2Swizecho "" >> bt8xx.h
811.2Swizecho "#ifndef _DEV_IC_BT8XX_H_" >> bt8xx.h
821.2Swizecho "#define _DEV_IC_BT8XX_H_" >> bt8xx.h
831.1Swizcat ioctl_meteor.h ioctl_bt848.h | grep -v _MACHINE_IOCTL_METEOR_H_ | \
841.1Swiz	grep -v _MACHINE_IOCTL_BT848_H >> bt8xx.h
851.2Swizecho "#endif /* _DEV_IC_BT8XX_H_ */" >> bt8xx.h
861.1Swizrm ioctl_meteor.h ioctl_bt848.h
871.1Swiz
881.1Swizecho done
891.1Swiz
901.1Swiz### move bt8xx.h to correct place
911.1Swizecho moving bt8xx.h to dev/ic
921.1Swizmkdir -p $d/../../ic
931.1Swizmv bt8xx.h $d/../../ic
941.1Swiz
951.1Swiz### Clean up any CVS directories that might be around.
961.1Swizecho "cleaning up CVS residue."
971.1Swiz(
981.1Swiz	cd $d
991.1Swiz	find . -type d -name "CVS" -print | xargs rm -r
1001.1Swiz)
1011.1Swizecho done
1021.1Swiz
1031.1Swiz### Fixing file and directory permissions.
1041.1Swizecho "Fixing file/directory permissions."
1051.1Swiz(
1061.1Swiz	cd $d
1071.1Swiz	find . -type f -print | xargs chmod u+rw,go+r
1081.1Swiz	find . -type d -print | xargs chmod u+rwx,go+rx
1091.1Swiz)
1101.1Swizecho done
1111.1Swiz
1121.4Swizecho Now do:
1131.4Swizecho cd $d/../..
1141.4Swizecho and import into src/sys/dev with
1151.4Swizecho Vendor: BKTR_SF
1161.4Swizecho Release: BKTR_YYYY_MM_DD
1171.4Swiz
1181.4Swizecho Do not forget to tag the imported version in the sourceforge repository!
1191.1Swizexit 0
120