1 #!/sbin/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 2010 Sun Microsystems, Inc. All rights reserved. 25 # Use is subject to license terms. 26 # 27 28 # 29 # postinstall script for SUNWos86r package. 30 # 31 32 # check_add_drv() checks if the module has an entry in 33 # etc/name_to_major. If not, it simply calls add_drv with the arguments 34 # given. If there is such an entry in name_to_major file, it adds 35 # entries in driver_aliases driver_classes and minor_perm if necessary. 36 # The syntax of this function is the same as add_drv. 37 38 check_add_drv() 39 { 40 basedir=/ 41 alias="" 42 class="" 43 ADD_ALIAS=0 44 ADD_CLASS=0 45 ADD_MINOR=0 46 OPTIND=1 47 IS_NET_DRIVER=0 48 49 cmd="add_drv" 50 51 while getopts i:b:m:c:n opt 52 do 53 case $opt in 54 i ) ADD_ALIAS=1 55 alias=$OPTARG 56 cmd=$cmd" -i '$alias'" 57 ;; 58 m ) ADD_MINOR=1 59 minor=$OPTARG 60 cmd=$cmd" -m '$minor'" 61 ;; 62 c) ADD_CLASS=1 63 class=$OPTARG 64 cmd=$cmd" -c $class" 65 ;; 66 b) basedir=$OPTARG 67 cmd=$cmd" -b $basedir" 68 ;; 69 n) IS_NET_DRIVER=1 70 ;; 71 \?) echo "check_add_drv can not handle this option" 72 return 73 ;; 74 esac 75 done 76 shift `/usr/bin/expr $OPTIND - 1` 77 78 drvname=$1 79 80 cmd=$cmd" "$drvname 81 82 drvname=`echo $drvname | /usr/bin/sed 's;.*/;;g'` 83 84 /usr/bin/grep "^$drvname[ ]" $basedir/etc/name_to_major > /dev/null 2>&1 85 86 if [ $? -ne 0 ] 87 then 88 eval $cmd 89 else 90 # entry already in name_to_major, add alias, class, minorperm 91 # if necessary 92 if [ $ADD_ALIAS = 1 ] 93 then 94 for i in $alias 95 do 96 /usr/bin/egrep "^$drvname[ ]+$i" $basedir/etc/driver_aliases>/dev/null 2>&1 97 if [ $? -ne 0 ] 98 then 99 echo "$drvname $i" >> $basedir/etc/driver_aliases 100 fi 101 done 102 fi 103 104 if [ $ADD_CLASS = 1 ] 105 then 106 /usr/bin/egrep "^$drvname[ ]+$class( | |$)" $basedir/etc/driver_classes > /dev/null 2>&1 107 if [ $? -ne 0 ] 108 then 109 echo "$drvname\t$class" >> $basedir/etc/driver_classes 110 fi 111 fi 112 113 if [ $ADD_MINOR = 1 ] 114 then 115 /usr/bin/grep "^$drvname:" $basedir/etc/minor_perm > /dev/null 2>&1 116 if [ $? -ne 0 ] 117 then 118 minorentry="$drvname:$minor" 119 echo $minorentry >> $basedir/etc/minor_perm 120 fi 121 fi 122 123 fi 124 125 # The following clone device/dev is needed for Custom Jumpstart 126 127 if [ $IS_NET_DRIVER -eq 1 ] 128 then 129 CLONE_DEVICE=devices/pseudo/clone@0:$drvname 130 set `/usr/bin/grep "^clone[ ]" $basedir/etc/name_to_major` 131 CLONE_MAJ=$2 132 set `/usr/bin/grep "^$drvname[ ]" $basedir/etc/name_to_major` 133 DRIVER_MAJ=$2 134 mknod $basedir/$CLONE_DEVICE c $CLONE_MAJ $DRIVER_MAJ 135 chmod 600 $basedir/$CLONE_DEVICE 136 chgrp sys $basedir/$CLONE_DEVICE 137 chown root $basedir/$CLONE_DEVICE 138 ln -s ../$CLONE_DEVICE $basedir/dev/$drvname 139 fi 140 141 } 142 143 144 # check_rem_drv() checks if the module has an entry in 145 # etc/name_to_major. If so, it simply calls rem_drv with the arguments 146 # given to remove the driver from the system. The syntax of this 147 # function is the same as rem_drv. 148 149 check_rem_drv() 150 { 151 basedir=/ 152 OPTIND=1 153 154 cmd="rem_drv" 155 156 while getopts b: opt 157 do 158 case $opt in 159 b) basedir=$OPTARG 160 cmd=$cmd" -b $basedir" 161 ;; 162 \?) echo "check_rem_drv can not handle this option" 163 return 164 ;; 165 esac 166 done 167 shift `/usr/bin/expr $OPTIND - 1` 168 169 drvname=$1 170 171 cmd=$cmd" "$drvname 172 173 drvname=`echo $drvname | /usr/bin/sed 's;.*/;;g'` 174 175 /usr/bin/grep "^$drvname[ ]" $basedir/etc/name_to_major > /dev/null 2>&1 176 177 if [ $? -eq 0 ] 178 then 179 eval $cmd 180 fi 181 } 182 183 184 # Platform-specific drivers 185 case "${ARCH}" in 186 i386) 187 check_add_drv -b "${BASEDIR}" \ 188 -i '"pci1011,2" "pci1011,9" "pci1011,14" "pci1011,19" 189 "pci1109,1400" "pci1109,2400" "pci10b8,2001" "pci2646,1"' \ 190 dnet 191 check_add_drv -b "${BASEDIR}" -i \ 192 '"pci10b7,9000" "pci10b7,9001" "pci10b7,9004" "pci10b7,9005" 193 "pci10b7,9006" "pci10b7,9050" "pci10b7,9051" "pci10b7,9055" 194 "pci10b7,9056" "pci10b7,9200" "pci10b7,9800" "pci10b7,9805"' \ 195 elxl 196 check_add_drv -b "${BASEDIR}" \ 197 -i '"pci1022,2000" "pci103c,104c"' \ 198 pcn 199 check_add_drv -b "${BASEDIR}" \ 200 -i '"pci1011,21" "pci1014,22"' \ 201 pci_pci 202 check_add_drv -b "${BASEDIR}" \ 203 -c scsi \ 204 -i '"pci1000,1" "pci1000,2" "pci1000,3" "pci1000,4" 205 "pci1000,6" "pci1000,c" "pci1000,f" "pci1000,8f" ' \ 206 ncrs 207 check_add_drv -b "${BASEDIR}" \ 208 -i '"pci8086,1029" "pci8086,1229" 209 "pci8086,1229.8086.1" "pci8086,1229.8086.2" 210 "pci8086,1229.8086.3" "pci8086,1229.8086.4" 211 "pci8086,1229.8086.5" "pci8086,1229.8086.6" 212 "pci8086,1229.8086.7" "pci8086,1229.8086.8" 213 "pci8086,1229.8086.9" "pci8086,1229.8086.a" 214 "pci8086,1229.8086.b" "pci8086,1229.8086.c" 215 "pci8086,1229.8086.d" "pci8086,1229.8086.e" 216 "pci8086,1229.8086.f" "pci8086,1229.8086.10" 217 "pci8086,1229.8086.11" "pci8086,1229.8086.12" 218 "pci8086,1229.8086.13" "pci8086,1229.8086.30" 219 "pci8086,1229.8086.31" "pci8086,1229.8086.40" 220 "pci8086,1229.8086.41" "pci8086,1229.8086.42" 221 "pci8086,1229.8086.50" "pci8086,1229.8086.1009" 222 "pci8086,1229.8086.100c" "pci8086,1229.8086.1012" 223 "pci8086,1229.8086.1013" "pci8086,1229.8086.1015" 224 "pci8086,1229.8086.1016" "pci8086,1229.8086.1017" 225 "pci8086,1229.8086.1030" "pci8086,1229.8086.1040" 226 "pci8086,1229.8086.1041" "pci8086,1229.8086.1042" 227 "pci8086,1229.8086.1050" "pci8086,1229.8086.1051" 228 "pci8086,1229.8086.1052" "pci8086,1229.8086.10f0" 229 "pci8086,1229.8086.1229" "pci8086,1229.8086.2009" 230 "pci8086,1229.8086.200d" "pci8086,1229.8086.200e" 231 "pci8086,1229.8086.200f" "pci8086,1229.8086.2010" 232 "pci8086,1229.8086.2013" "pci8086,1229.8086.2016" 233 "pci8086,1229.8086.2017" "pci8086,1229.8086.2018" 234 "pci8086,1229.8086.2019" "pci8086,1229.8086.2101" 235 "pci8086,1229.8086.2102" "pci8086,1229.8086.2103" 236 "pci8086,1229.8086.2104" "pci8086,1229.8086.2105" 237 "pci8086,1229.8086.2106" "pci8086,1229.8086.2107" 238 "pci8086,1229.8086.2108" "pci8086,1229.8086.2200" 239 "pci8086,1229.8086.2201" "pci8086,1229.8086.2202" 240 "pci8086,1229.8086.2203" "pci8086,1229.8086.2204" 241 "pci8086,1229.8086.2205" "pci8086,1229.8086.2206" 242 "pci8086,1229.8086.2207" "pci8086,1229.8086.2208" 243 "pci8086,1229.8086.2402" "pci8086,1229.8086.2407" 244 "pci8086,1229.8086.2408" "pci8086,1229.8086.2409" 245 "pci8086,1229.8086.240f" "pci8086,1229.8086.2410" 246 "pci8086,1229.8086.2411" "pci8086,1229.8086.2412" 247 "pci8086,1229.8086.2413" "pci8086,1229.8086.3000" 248 "pci8086,1229.8086.3001" "pci8086,1229.8086.3002" 249 "pci8086,1229.8086.3006" "pci8086,1229.8086.3007" 250 "pci8086,1229.8086.3008" "pci8086,1229.8086.3010" 251 "pci8086,1229.8086.3011" "pci8086,1229.8086.3012" 252 "pci8086,1229.8086.301a" "pci8086,1229.8086.3411" 253 "pci8086,1030" "pci8086,1031" "pci8086,1032" "pci8086,1038" 254 "pci8086,1039" "pci8086,103d" "pci8086,1050" "pci8086,1059" 255 "pci8086,103d.8086.103d" "pci8086,1050.8086.3020" 256 "pci8086,1050.8086.302f" "pci8086,1050.8086.3427" 257 "pci8086,1068" "pci8086,1069" "pci8086,1092" "pci8086,1209" 258 "pci8086,2449" "pci8086,27dc" 259 "pci8086,2449.8086.3010" "pci8086,2449.8086.3011" 260 "pci8086,2449.8086.3012" "pci8086,2449.8086.3013" 261 "pci8086,2449.8086.3014" "pci8086,2449.8086.3015" 262 "pci8086,2449.8086.3016" "pci8086,2449.8086.3017" 263 "pci8086,2449.8086.3018" "pci8086,27dc.8086.308d"' \ 264 iprb 265 check_add_drv -b "${BASEDIR}" \ 266 -i '"pci10b8,5"' \ 267 spwr 268 269 # The sd driver should be installed to the system before rcs9.sh 270 # is called. 271 check_add_drv -b "${BASEDIR}" \ 272 -m '* 0640 root sys' \ 273 -i '"scsiclass,00" "scsiclass,05"' \ 274 sd 275 276 # Call the rcs9.sh script to update necessary files in case of upgrade 277 # for the PCI physical device pathname change from 2.4. 278 # 279 # Also used to preserve escd.rf (devconf configuration information) 280 # saved on floppy during an install boot. 281 # 282 283 if [ -s /tmp/diskette_rc.d/rcs9.sh ] 284 then 285 /sbin/sh /tmp/diskette_rc.d/rcs9.sh "post" 286 fi 287 288 # 289 # If there is no data in OWconfig, remove it. 290 # 291 OWC=/etc/openwin/server/etc/OWconfig 292 removef $PKGINST $OWC |\ 293 while read pathname 294 do 295 if [ ! -s $pathname ]; then 296 echo Removing empty `basename $pathname` 297 rm -f $pathname 298 fi 299 done 300 removef -f $PKGINST 301 302 ;; 303 esac 304 305 # Remove erroneous entry for Symbios Logic 53c875/95 (ncrs) 306 TMPFILE=/tmp/ncrs_tmp 307 sed -e '/^ncrs "pci1000,1000"$/d' ${BASEDIR}/etc/driver_aliases >$TMPFILE 308 cp $TMPFILE ${BASEDIR}/etc/driver_aliases 309 310 exit 0 311