Home | History | Annotate | Line # | Download | only in bktr
      1 #! /bin/sh
      2 #
      3 #	$NetBSD: bktr2netbsd,v 1.7 2024/09/08 10:02:00 rillig Exp $
      4 #
      5 # Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
      6 # All rights reserved.
      7 #
      8 # Redistribution and use in source and binary forms, with or without
      9 # modification, are permitted provided that the following conditions
     10 # are met:
     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.
     16 #
     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.
     28 #
     29 # bktr2netbsd:  convert sourceforge bktr source tree into
     30 # netbsd bktr source tree, under sys/dev/pci/bktr
     31 # originally based on bind2netbsd by Bernd Ernesti
     32 
     33 if [ $# -ne 2 ]; then echo "bktr2netbsd src dest"; exit 1; fi
     34 
     35 r=$1
     36 d=$2/sys/dev/pci/bktr
     37 
     38 case "$d" in
     39 	/*)
     40 		;;
     41 	*)
     42 		d=`/bin/pwd`/$d
     43 		;;
     44 esac
     45 
     46 case "$r" in
     47 	/*)
     48 		;;
     49 	*)
     50 		r=`/bin/pwd`/$r
     51 		;;
     52 esac
     53 
     54 echo preparing directory $d
     55 rm -rf $d
     56 mkdir -p $d
     57 
     58 ### Copy the files
     59 echo copying $r to $d
     60 cd $r
     61 pax -rw * $d
     62 
     63 echo removing unneeded files
     64 
     65 ### Remove unneeded files
     66 cd $d
     67 rm -f CHANGELOG.TXT README.* bktr_i2c.[ch]
     68 
     69 ### Remove the $'s around RCS tags
     70 find $d -type f -print | xargs egrep -l '\$Id:' | while read f; do
     71 	sed -e 's/\$\(Id:\)\(.*\) \$/SourceForge:\2/' \
     72 	    < $f > /tmp/bktr1f$$ && mv /tmp/bktr1f$$ $f && \
     73 	echo quoted \$RCS tag from $f
     74 done
     75 
     76 ### create bt8xx.h from ioctl_meteor.h and ioctl_bt848.h
     77 echo merging ioctl_meteor.h and ioctl_bt848.h to bt8xx.h
     78 echo "/* This file is merged from ioctl_meteor.h and ioctl_bt848.h from FreeBSD. */" > bt8xx.h
     79 echo "/* The copyright below only applies to the ioctl_meteor.h part of this file. */" >> bt8xx.h
     80 echo "" >> bt8xx.h
     81 echo "#ifndef _DEV_IC_BT8XX_H_" >> bt8xx.h
     82 echo "#define _DEV_IC_BT8XX_H_" >> bt8xx.h
     83 cat ioctl_meteor.h ioctl_bt848.h | grep -v _MACHINE_IOCTL_METEOR_H_ | \
     84 	grep -v _MACHINE_IOCTL_BT848_H >> bt8xx.h
     85 echo "#endif /* _DEV_IC_BT8XX_H_ */" >> bt8xx.h
     86 rm ioctl_meteor.h ioctl_bt848.h
     87 
     88 echo done
     89 
     90 ### move bt8xx.h to correct place
     91 echo moving bt8xx.h to dev/ic
     92 mkdir -p $d/../../ic
     93 mv bt8xx.h $d/../../ic
     94 
     95 ### Clean up any CVS directories that might be around.
     96 echo "cleaning up CVS residue."
     97 (
     98 	cd $d
     99 	find . -type d -name "CVS" -print | xargs rm -r
    100 )
    101 echo done
    102 
    103 ### Fixing file and directory permissions.
    104 echo "Fixing file/directory permissions."
    105 (
    106 	cd $d
    107 	find . -type f -print | xargs chmod u+rw,go+r
    108 	find . -type d -print | xargs chmod u+rwx,go+rx
    109 )
    110 echo done
    111 
    112 echo Now do:
    113 echo cd $d/../..
    114 echo and import into src/sys/dev with
    115 echo Vendor: BKTR_SF
    116 echo Release: BKTR_YYYY_MM_DD
    117 
    118 echo Do not forget to tag the imported version in the sourceforge repository!
    119 exit 0
    120