Home | History | Annotate | Download | only in common_files
      1 #
      2 # CDDL HEADER START
      3 #
      4 # The contents of this file are subject to the terms of the
      5 # Common Development and Distribution License (the "License").
      6 # You may not use this file except in compliance with the License.
      7 #
      8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9 # or http://www.opensolaris.org/os/licensing.
     10 # See the License for the specific language governing permissions
     11 # and limitations under the License.
     12 #
     13 # When distributing Covered Code, include this CDDL HEADER in each
     14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15 # If applicable, add the following below this CDDL HEADER, with the
     16 # fields enclosed by brackets "[]" replaced with your own identifying
     17 # information: Portions Copyright [yyyy] [name of copyright owner]
     18 #
     19 # CDDL HEADER END
     20 #
     21 
     22 #
     23 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     24 # Use is subject to license terms.
     25 #
     26 #ident	"%Z%%M%	%I%	%E% SMI"
     27 #
     28 
     29 PATH="/usr/bin:/usr/sbin:${PATH}"
     30 export PATH
     31 
     32 add_self_identifying_entry() {
     33 cat >> $dest <<EOF
     34 
     35 #
     36 # The following stub node is needed for pathological bottom-up
     37 # devid resolution on a self-identifying transport. 
     38 #
     39 name="sd" class="scsi-self-identifying";
     40 EOF
     41 }
     42 
     43 while read src dest
     44 do
     45 	if [ ! -f $dest ] ; then
     46 		cp $src $dest
     47 	else
     48 		#
     49 		# remove entries for eol'ed blogic drivers
     50 		# remove entries for eol'ed flashpt drivers
     51 		#
     52 		sed -e '/^name="sd" parent="blogic"$/N'	\
     53 		-e '/^name="sd" parent="blogic" target=0 lun=0;$/d' \
     54 		-e '/^name="sd" parent="blogic" target=1 lun=0;$/d' \
     55 		-e '/^name="sd" parent="blogic" target=2 lun=0;$/d' \
     56 		-e '/^name="sd" parent="blogic" target=3 lun=0;$/d' \
     57 		-e '/^name="sd" parent="blogic" target=4 lun=0;$/d' \
     58 		-e '/^name="sd" parent="blogic" target=5 lun=0;$/d' \
     59 		-e '/^name="sd" parent="blogic" target=6 lun=0;$/d' \
     60 		-e '/^name="sd" parent="blogic"\n	target=0 lun=0;$/N' \
     61 		-e '/^name="sd" parent="blogic"\n	target=1 lun=0;$/N' \
     62 		-e '/^name="sd" parent="blogic"\n	target=2 lun=0;$/N' \
     63 		-e '/^name="sd" parent="blogic"\n	target=3 lun=0;$/N' \
     64 		-e '/^name="sd" parent="blogic"\n	target=4 lun=0;$/N' \
     65 		-e '/^name="sd" parent="blogic"\n	target=5 lun=0;$/N' \
     66 		-e '/^name="sd" parent="blogic"\n	target=6 lun=0;$/N' \
     67 		-e '/^name="sd" parent="blogic"\n	target=0 lun=0;\n$/d' \
     68 		-e '/^name="sd" parent="blogic"\n	target=1 lun=0;\n$/d' \
     69 		-e '/^name="sd" parent="blogic"\n	target=2 lun=0;\n$/d' \
     70 		-e '/^name="sd" parent="blogic"\n	target=3 lun=0;\n$/d' \
     71 		-e '/^name="sd" parent="blogic"\n	target=4 lun=0;\n$/d' \
     72 		-e '/^name="sd" parent="blogic"\n	target=5 lun=0;\n$/d' \
     73 		-e '/^name="sd" parent="blogic"\n	target=6 lun=0;\n$/d' \
     74 		-e '/^name="sd" parent="flashpt" target=0 lun=0;$/d' \
     75 		-e '/^name="sd" parent="flashpt" target=1 lun=0;$/d' \
     76 		-e '/^name="sd" parent="flashpt" target=2 lun=0;$/d' \
     77 		-e '/^name="sd" parent="flashpt" target=3 lun=0;$/d' \
     78 		-e '/^name="sd" parent="flashpt" target=4 lun=0;$/d' \
     79 		-e '/^name="sd" parent="flashpt" target=5 lun=0;$/d' \
     80 		-e '/^name="sd" parent="flashpt" target=6 lun=0;$/d' \
     81 		-e '/^name="sd" parent="flashpt"\n	target=0 lun=0;$/N' \
     82 		-e '/^name="sd" parent="flashpt"\n	target=1 lun=0;$/N' \
     83 		-e '/^name="sd" parent="flashpt"\n	target=2 lun=0;$/N' \
     84 		-e '/^name="sd" parent="flashpt"\n	target=3 lun=0;$/N' \
     85 		-e '/^name="sd" parent="flashpt"\n	target=4 lun=0;$/N' \
     86 		-e '/^name="sd" parent="flashpt"\n	target=5 lun=0;$/N' \
     87 		-e '/^name="sd" parent="flashpt"\n	target=6 lun=0;$/N' \
     88 		-e '/^name="sd" parent="flashpt"\n	target=0 lun=0;\n$/d' \
     89 		-e '/^name="sd" parent="flashpt"\n	target=1 lun=0;\n$/d' \
     90 		-e '/^name="sd" parent="flashpt"\n	target=2 lun=0;\n$/d' \
     91 		-e '/^name="sd" parent="flashpt"\n	target=3 lun=0;\n$/d' \
     92 		-e '/^name="sd" parent="flashpt"\n	target=4 lun=0;\n$/d' \
     93 		-e '/^name="sd" parent="flashpt"\n	target=5 lun=0;\n$/d' \
     94 		-e '/^name="sd" parent="flashpt"\n	target=6 lun=0;\n$/d' \
     95 		-e '/^# Add SATA HBA drivers as parents of sd driver.$/d' \
     96 		-e '/^name="sd" parent="nv_sata";$/d' \
     97 		-e '/^name="sd" parent="ahci";$/d' \
     98 		-e '/^name="sd" parent="si3124";$/d' \
     99 		-e '/^name="sd" parent="marvell88sx";$/d' \
    100 			$dest > /tmp/d2.$$
    101 
    102 		if cmp -s $dest /tmp/d2.$$  > /dev/null 2>&1
    103 		then
    104 			: # Do not modify file unless changes are required.
    105 		else
    106 			cp /tmp/d2.$$ $dest
    107 		fi
    108 		echo `cat $dest` | grep "scsi-self-identifying" > /dev/null
    109 
    110 		if [ $? -ne 0 ]; then
    111 			add_self_identifying_entry
    112 		fi
    113 		# remove temporary file
    114 		rm -f /tmp/d2.$$
    115 	fi
    116 done
    117 
    118 exit 0
    119