Home | History | Annotate | Line # | Download | only in bktr
bktr2netbsd revision 1.2
      1  1.1  wiz #! /bin/sh
      2  1.1  wiz #
      3  1.2  wiz #	$NetBSD: bktr2netbsd,v 1.2 2000/05/07 03:01:58 wiz Exp $
      4  1.1  wiz #
      5  1.1  wiz # Copyright (c) 2000 The NetBSD Foundation, Inc.
      6  1.1  wiz # All rights reserved.
      7  1.1  wiz #
      8  1.1  wiz # Redistribution and use in source and binary forms, with or without
      9  1.1  wiz # modification, are permitted provided that the following conditions
     10  1.1  wiz # are met:
     11  1.1  wiz # 1. Redistributions of source code must retain the above copyright
     12  1.1  wiz #    notice, this list of conditions and the following disclaimer.
     13  1.1  wiz # 2. Redistributions in binary form must reproduce the above copyright
     14  1.1  wiz #    notice, this list of conditions and the following disclaimer in the
     15  1.1  wiz #    documentation and/or other materials provided with the distribution.
     16  1.1  wiz # 3. All advertising materials mentioning features or use of this software
     17  1.1  wiz #    must display the following acknowledgement:
     18  1.1  wiz #	This product includes software developed by the NetBSD
     19  1.1  wiz #	Foundation, Inc. and its contributors.
     20  1.1  wiz # 4. Neither the name of The NetBSD Foundation nor the names of its
     21  1.1  wiz #    contributors may be used to endorse or promote products derived
     22  1.1  wiz #    from this software without specific prior written permission.
     23  1.1  wiz #
     24  1.1  wiz # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     25  1.1  wiz # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     26  1.1  wiz # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     27  1.1  wiz # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     28  1.1  wiz # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     29  1.1  wiz # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     30  1.1  wiz # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     31  1.1  wiz # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     32  1.1  wiz # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     33  1.1  wiz # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     34  1.1  wiz # POSSIBILITY OF SUCH DAMAGE.
     35  1.1  wiz #
     36  1.1  wiz # bktr2netbsd:  convert a bktr source directory tree into a
     37  1.1  wiz # netbsd bktr source tree, under sys/dev/pci/bktr
     38  1.1  wiz # based on bind2netbsd by Bernd Ernesti
     39  1.1  wiz 
     40  1.1  wiz if [ $# -ne 2 ]; then echo "bktr2netbsd src dest"; exit 1; fi
     41  1.1  wiz 
     42  1.1  wiz r=$1
     43  1.1  wiz d=$2/sys/dev/pci/bktr
     44  1.1  wiz 
     45  1.1  wiz case "$d" in
     46  1.1  wiz 	/*)
     47  1.1  wiz 		;;
     48  1.1  wiz 	*)
     49  1.1  wiz 		d=`/bin/pwd`/$d
     50  1.1  wiz 		;;
     51  1.1  wiz esac
     52  1.1  wiz 
     53  1.1  wiz case "$r" in
     54  1.1  wiz 	/*)
     55  1.1  wiz 		;;
     56  1.1  wiz 	*)
     57  1.1  wiz 		r=`/bin/pwd`/$r
     58  1.1  wiz 		;;
     59  1.1  wiz esac
     60  1.1  wiz 
     61  1.1  wiz echo preparing directory $d
     62  1.1  wiz rm -rf $d
     63  1.1  wiz mkdir -p $d
     64  1.1  wiz 
     65  1.1  wiz ### Copy the files
     66  1.1  wiz echo copying $r to $d
     67  1.1  wiz cd $r
     68  1.1  wiz pax -rw * $d
     69  1.1  wiz 
     70  1.1  wiz echo removing unneeded files
     71  1.1  wiz 
     72  1.1  wiz ### Remove unneeded files
     73  1.1  wiz cd $d
     74  1.1  wiz rm CHANGELOG.TXT README.* bktr_i2c.[ch]
     75  1.1  wiz 
     76  1.1  wiz ### Remove the $'s around RCS tags
     77  1.1  wiz find $d -type f -print | xargs egrep -l '\$(Id|Created|Header|FreeBSD)' | while read f; do
     78  1.1  wiz 	sed -e 's/\$\(Id.*\) \$/\1/' \
     79  1.1  wiz 	    -e 's/\$\(Created.*\) \$/\1/' \
     80  1.1  wiz 	    -e 's/\$\(FreeBSD.*\) \$/\1/' \
     81  1.1  wiz 	    -e 's/\$\(Header.*\) \$/\1/' \
     82  1.1  wiz 	    < $f > /tmp/bktr1f$$ && mv /tmp/bktr1f$$ $f && \
     83  1.1  wiz 	echo removed \$RCS tag from $f
     84  1.1  wiz done
     85  1.1  wiz 
     86  1.1  wiz ### create bt8xx.h from ioctl_meteor.h and ioctl_bt848.h
     87  1.1  wiz echo merging ioctl_meteor.h and ioctl_bt848.h to bt8xx.h
     88  1.1  wiz echo "/* This file is merged from ioctl_meteor.h and ioctl_bt848.h from FreeBSD. */" > bt8xx.h
     89  1.1  wiz echo "/* The copyright below only applies to the ioctl_meteor.h part of this file. */" >> bt8xx.h
     90  1.2  wiz echo "" >> bt8xx.h
     91  1.2  wiz echo "#ifndef _DEV_IC_BT8XX_H_" >> bt8xx.h
     92  1.2  wiz echo "#define _DEV_IC_BT8XX_H_" >> bt8xx.h
     93  1.1  wiz cat ioctl_meteor.h ioctl_bt848.h | grep -v _MACHINE_IOCTL_METEOR_H_ | \
     94  1.1  wiz 	grep -v _MACHINE_IOCTL_BT848_H >> bt8xx.h
     95  1.2  wiz echo "#endif /* _DEV_IC_BT8XX_H_ */" >> bt8xx.h
     96  1.1  wiz rm ioctl_meteor.h ioctl_bt848.h
     97  1.1  wiz 
     98  1.1  wiz ### Add our NetBSD RCS Id
     99  1.1  wiz find $d -name '*.[chly]' -print | while read c; do
    100  1.1  wiz 	sed 1q < $c | grep -q '\$NetBSD' || (
    101  1.1  wiz echo "/*	\$NetBSD\$	*/" >/tmp/bktr3n$$
    102  1.1  wiz echo "" >>/tmp/bktr3n$$
    103  1.1  wiz cat $c  >> /tmp/bktr3n$$
    104  1.1  wiz mv /tmp/bktr3n$$ $c && echo added NetBSD RCS tag to $c
    105  1.1  wiz 	)
    106  1.1  wiz done
    107  1.1  wiz 
    108  1.1  wiz echo done
    109  1.1  wiz 
    110  1.1  wiz ### move bt8xx.h to correct place
    111  1.1  wiz echo moving bt8xx.h to dev/ic
    112  1.1  wiz mkdir -p $d/../../ic
    113  1.1  wiz mv bt8xx.h $d/../../ic
    114  1.1  wiz 
    115  1.1  wiz ### Clean up any CVS directories that might be around.
    116  1.1  wiz echo "cleaning up CVS residue."
    117  1.1  wiz (
    118  1.1  wiz 	cd $d
    119  1.1  wiz 	find . -type d -name "CVS" -print | xargs rm -r
    120  1.1  wiz )
    121  1.1  wiz echo done
    122  1.1  wiz 
    123  1.1  wiz ### Fixing file and directory permissions.
    124  1.1  wiz echo "Fixing file/directory permissions."
    125  1.1  wiz (
    126  1.1  wiz 	cd $d
    127  1.1  wiz 	find . -type f -print | xargs chmod u+rw,go+r
    128  1.1  wiz 	find . -type d -print | xargs chmod u+rwx,go+rx
    129  1.1  wiz )
    130  1.1  wiz echo done
    131  1.1  wiz 
    132  1.1  wiz echo Do not forget to also import bt8xx.h in dev/ic!
    133  1.1  wiz exit 0
    134