PSARC 2007/045 I2O EOL and EOF
4863632 Hey Hey! Ho Ho! I2O Has Got to Go!
1 #!/bin/sh
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27 #ident "@(#)i.drvalias 1.27 06/09/11 SMI"
28
29 PATH=/usr/bin:/usr/sbin:$PATH; export PATH
30
31 #
32 # obsolete_sparc - Filter function to remove obsolete SPARC driver aliases.
33 # Use sed to delete lines matching driver aliases we want to remove.
34 #
35 obsolete_sparc()
36 {
37 sed \
38 -e '/^[ ]*cpu[ ][ ]*modi4v0m$/d' \
39 -e '/^[ ]*cpu[ ][ ]*modi4v0m[ #].*$/d' \
40 -e '/^[ ]*PFUaga[ ][ ]*PFU,aga$/d' \
41 -e '/^[ ]*PFUaga[ ][ ]*PFU,aga[ #].*$/d' \
42 -e '/^[ ]*dbri[ ][ ]*SUNW,DBRIs3$/d' \
43 -e '/^[ ]*dbri[ ][ ]*SUNW,DBRIs3[ #].*$/d' \
44 -e '/^[ ]*dbri[ ][ ]*SUNW,DBRId$/d' \
45 -e '/^[ ]*dbri[ ][ ]*SUNW,DBRId[ #].*$/d' \
46 -e '/^[ ]*dbri[ ][ ]*SUNW,DBRIe$/d' \
47 -e '/^[ ]*dbri[ ][ ]*SUNW,DBRIe[ #].*$/d' \
48 -e '/^[ ]*dbri[ ][ ]*SUNW,DBRIf$/d' \
49 -e '/^[ ]*dbri[ ][ ]*SUNW,DBRIf[ #].*$/d' \
50 -e '/^[ ]*leo[ ][ ]*SUNW,leo104$/d' \
51 -e '/^[ ]*leo[ ][ ]*SUNW,leo104[ #].*$/d' \
52 -e '/^[ ]*atapicd[ ][ ]*"ide-cdrom"$/d' \
53 -e '/^[ ]*atapicd[ ][ ]*"ide-cdrom"[ #].*$/d' \
54 -e '/^[ ]*cpu[ ][ ]*TI,TMS390Z50$/d' \
55 -e '/^[ ]*cpu[ ][ ]*TI,TMS390Z50[ #].*$/d' \
56 -e '/^[ ]*obio[ ][ ]*bootbus$/d' \
57 -e '/^[ ]*obio[ ][ ]*bootbus[ #].*$/d' \
58 -e '/^[ ]*sw[ ][ ]*drum$/d' \
59 -e '/^[ ]*sw[ ][ ]*drum[ #].*$/d' \
60 -e '/^[ ]*ie[ ][ ]*sie$/d' \
61 -e '/^[ ]*ie[ ][ ]*sie[ #].*$/d' \
62 -e '/^[ ]*sbus[ ][ ]*sbi$/d' \
63 -e '/^[ ]*sbus[ ][ ]*sbi[ #].*$/d' \
64 -e '/^[ ]*pn[ ][ ]*SUNW,pn$/d' \
65 -e '/^[ ]*pn[ ][ ]*SUNW,pn[ #].*$/d' \
66 -e '/^[ ]*glm[ ][ ]*SUNW,glm$/d' \
67 -e '/^[ ]*glm[ ][ ]*SUNW,glm[ #].*$/d' \
68 -e '/^[ ]*gpio_87317[ ][ ]*"gpio"$/d' \
69 -e '/^[ ]*gpio_87317[ ][ ]*"gpio"[ #].*$/d' \
70 -e '/^[ ]*pci[ ][ ]*SUNW,pci$/d' \
71 -e '/^[ ]*pci[ ][ ]*SUNW,pci[ #].*$/d' \
72 -e '/^[ ]*pci[ ][ ]*"pci108e,8000"$/d' \
73 -e '/^[ ]*pci[ ][ ]*"pci108e,8000"[ #].*$/d' \
74 -e '/^[ ]*pci[ ][ ]*"pci108e,a000"$/d' \
75 -e '/^[ ]*pci[ ][ ]*"pci108e,a000"[ #].*$/d' \
76 -e '/^[ ]*pci[ ][ ]*"pciclass,060000"$/d' \
77 -e '/^[ ]*pci[ ][ ]*"pciclass,060000"[ #].*$/d' \
78 -e '/^[ ]*px[ ][ ]*"pci108e,80f0"$/d' \
79 -e '/^[ ]*px[ ][ ]*"pci108e,80f0"[ #].*$/d' \
80 -e '/^[ ]*px_pci[ ][ ]*"pci1033,124"$/d' \
81 -e '/^[ ]*px_pci[ ][ ]*"pci1033,124"[ #].*$/d' \
82 -e '/^[ ]*px_pci[ ][ ]*"pci1033,125"$/d' \
83 -e '/^[ ]*px_pci[ ][ ]*"pci1033,125"[ #].*/d' \
84 -e '/^[ ]*px_pci[ ][ ]*"pci8086,340"$/d' \
85 -e '/^[ ]*px_pci[ ][ ]*"pci8086,340"[ #].*$/d' \
86 -e '/^[ ]*px_pci[ ][ ]*"pci8086,341"$/d' \
87 -e '/^[ ]*px_pci[ ][ ]*"pci8086,341"[ #].*$/d' \
88 -e '/^[ ]*px_pci[ ][ ]*"pci10b5,8532"$/d' \
89 -e '/^[ ]*px_pci[ ][ ]*"pci10b5,8532"[ #].*$/d' \
90 -e '/^[ ]*px_pci[ ][ ]*"pci10b5,8516"$/d' \
91 -e '/^[ ]*px_pci[ ][ ]*"pci10b5,8516"[ #].*$/d' \
92 -e '/^[ ]*sx[ ][ ]*SUNW,sx$/d' \
93 -e '/^[ ]*sx[ ][ ]*SUNW,sx[ #].*$/d' \
94 -e '/^[ ]*sx[ ][ ]*"SUNW,sx"$/d' \
95 -e '/^[ ]*sx[ ][ ]*"SUNW,sx"[ #].*$/d' \
96 -e '/^[ ]*xbox[ ][ ]*SUNW,xbox$/d' \
97 -e '/^[ ]*xbox[ ][ ]*SUNW,xbox[ #].*$/d' \
98 -e '/^[ ]*xbox[ ][ ]*"SUNW,xbox"$/d' \
99 -e '/^[ ]*xbox[ ][ ]*"SUNW,xbox"[ #].*$/d' \
100 -e '/^[ ]*stc[ ][ ]*SUNW,spif$/d' \
101 -e '/^[ ]*stc[ ][ ]*SUNW,spif[ #].*$/d' \
102 -e '/^[ ]*fjulsa[ ][ ]*"pci13e9,30"$/d' \
103 -e '/^[ ]*fjulsa[ ][ ]*"pci13e9,30"[ #].*$/d' \
104 -e '/^[ ]*fjulsa[ ][ ]*"pci1000,30"$/d' \
105 -e '/^[ ]*fjulsa[ ][ ]*"pci1000,30"[ #].*$/d' \
106 -e '/^[ ]*cpu[ ][ ]*TI,TMS390Z55$/d' \
107 -e '/^[ ]*cpu[ ][ ]*TI,TMS390Z55[ #].*$/d' \
108 -e '/^[ ]*mic[ ][ ]*SUNW,mic$/d' \
109 -e '/^[ ]*mic[ ][ ]*SUNW,mic[ #].*$/d' \
110 -e '/^[ ]*pln[ ][ ]*SUNW,pln$/d' \
111 -e '/^[ ]*pln[ ][ ]*SUNW,pln[ #].*$/d' \
112 -e '/^[ ]*soc[ ][ ]*SUNW,soc$/d' \
113 -e '/^[ ]*soc[ ][ ]*SUNW,soc[ #].*$/d' \
114 -e '/^[ ]*sc_nct[ ][ ]*"nct-ds80ch11-smc"$/d' \
115 -e '/^[ ]*sc_nct[ ][ ]*"nct-ds80ch11-smc"[ #].*$/d' \
116 -e '/^[ ]*tomtppm[ ][ ]*jbus-ppm$/d' \
117 -e '/^[ ]*tomtppm[ ][ ]*jbus-ppm[ #].*$/d'
118 }
119
120 #
121 # obsolete_i386 - Filter function to remove obsolete i386 driver aliases.
122 #
123 obsolete_i386() {
124 sed \
125 -e '/^[ ]*elx[^l].*10b7,9000.*/d' \
126 -e '/^[ ]*elx[^l].*10b7,9050.*/d' \
127 -e '/^[ ]*dpt[ ][ ]*"pci1044,a400"$/d' \
128 -e '/^[ ]*dpt[ ][ ]*"pci1044,a400"[ #].*$/d' \
129 -e '/^[ ]*audiocs[ ][ ]*"SUNW,CS4231"$/d' \
130 -e '/^[ ]*audiocs[ ][ ]*"SUNW,CS4231"[ #].*$/d' \
131 -e '/^[ ]*blogic[ ][ ]*"pci104b,1040"$/d' \
132 -e '/^[ ]*blogic[ ][ ]*"pci104b,1040"[ #].*$/d' \
133 -e '/^[ ]*mega[ ][ ]*"pci101e,9010"$/d' \
134 -e '/^[ ]*mega[ ][ ]*"pci101e,9010"[ #].*$/d' \
135 -e '/^[ ]*mlx[ ][ ]*"pci1069,1"$/d' \
136 -e '/^[ ]*mlx[ ][ ]*"pci1069,1"[ #].*$/d' \
137 -e '/^[ ]*mlx[ ][ ]*"pci1069,2"$/d' \
138 -e '/^[ ]*mlx[ ][ ]*"pci1069,2"[ #].*$/d' \
139 -e '/^[ ]*mlx[ ][ ]*"pci1069,10"$/d' \
140 -e '/^[ ]*mlx[ ][ ]*"pci1069,10"[ #].*$/d' \
141 -e '/^[ ]*mlx[ ][ ]*"pci1069,11"$/d' \
142 -e '/^[ ]*mlx[ ][ ]*"pci1069,11"[ #].*$/d' \
143 -e '/^[ ]*p9000[ ][ ]*"pci100e,9001"$/d' \
144 -e '/^[ ]*p9000[ ][ ]*"pci100e,9001"[ #].*$/d' \
145 -e '/^[ ]*p9100[ ][ ]*"pci100e,9100"$/d' \
146 -e '/^[ ]*p9100[ ][ ]*"pci100e,9100"[ #].*$/d' \
147 -e '/^[ ]*pcie_pci[ ][ ]*"pciex1011,1"$/d' \
148 -e '/^[ ]*pcie_pci[ ][ ]*"pciex1011,1"[ #].*$/d' \
149 -e '/^[ ]*pcie_pci[ ][ ]*"pciex1011,21"$/d' \
150 -e '/^[ ]*pcie_pci[ ][ ]*"pciex1011,21"[ #].*$/d' \
151 -e '/^[ ]*pcie_pci[ ][ ]*"pciex1014,22"$/d' \
152 -e '/^[ ]*pcie_pci[ ][ ]*"pciex1014,22"[ #].*$/d' \
153 -e '/^[ ]*spwr[ ][ ]*"pci10b8,0005"$/d' \
154 -e '/^[ ]*spwr[ ][ ]*"pci10b8,0005"[ #].*$/d' \
155 -e '/^[ ]*chs[ ][ ]*"pci1014,2e"$/d' \
156 -e '/^[ ]*chs[ ][ ]*"pci1014,2e"[ #].*$/d' \
157 -e '/^[ ]*cpqncr[ ][ ]*"pcie11,7004"$/d' \
158 -e '/^[ ]*cpqncr[ ][ ]*"pcie11,7004"[ #].*$/d' \
159 -e '/^[ ]*smartii[ ][ ]*"pcie11,4030"$/d' \
160 -e '/^[ ]*smartii[ ][ ]*"pcie11,4030"[ #].*$/d' \
161 -e '/^[ ]*smartii[ ][ ]*"pcie11,4031"$/d' \
162 -e '/^[ ]*smartii[ ][ ]*"pcie11,4031"[ #].*$/d'
163 }
164
165 #
166 # check if the driver aliase specified is already installed.
167 # ignore a comment if exists.
168 #
169 is_installed ()
170 {
171 file=$3
172 nawk -v driver=$1 -v alias=$2 -v delimiter='#' ' \
173 $1 == driver && $2 == alias \
174 { found = 1; exit 0 } \
175 $1 == driver \
176 { num = split($2, a_array, delimiter); \
177 if (num > 1 && a_array[1] == alias) \
178 { found = 1; exit 0 } \
179 } \
180 END { if (!found) exit 1 } ' $file
181 return $?
182 }
183
184 #
185 # Generate /etc/driver_aliases file. Each entry present in $src (the copy
186 # of driver_aliases being delivered by the package) is automatically added
187 # to $dest (the driver_aliases file on the target system) if not already
188 # present; thus it is NOT necessary to add any code below to cause a new
189 # alias which has been added to the driver_aliases source to be added to
190 # the target system on upgrade.
191 #
192 while read src dest; do
193 if [ -f $dest ]; then
194 #
195 # Strip obsolete entries from the existing driver_aliases
196 #
197 if [ $ARCH = sparc ]; then
198 obsolete_sparc < $dest > /tmp/oda.$$.tmp
199 cp /tmp/oda.$$.tmp $dest
200 rm -f /tmp/oda.$$.tmp
201 elif [ $ARCH = i386 ]; then
202 obsolete_i386 < $dest > /tmp/oda.$$.tmp
203 cp /tmp/oda.$$.tmp $dest
204 rm -f /tmp/oda.$$.tmp
205 fi
206 #
207 # Remove comment and/or blank lines before reading
208 #
209 egrep -v -e "^[ ]*#.*$|^[ ]*$" $src | \
210 sed -e 's/#.*$//' > /tmp/oda.$$.tmp
211 #
212 # If the alias is not present in the driver_aliases
213 # file, then append it:
214 #
215 while read driver alias; do
216 is_installed $driver $alias $dest \
217 >/dev/null 2>&1 || echo "$driver $alias" >>$dest
218 done < /tmp/oda.$$.tmp
219 rm -f /tmp/oda.$$.tmp
220 else
221 #
222 # If no driver_aliases is present on the target system,
223 # just copy over the one from the package.
224 #
225 cp -p $src $dest
226 fi
227 done
228 exit 0
--- EOF ---