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