Home | History | Annotate | Download | only in common_files
      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 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     23 # Use is subject to license terms.
     24 #
     25 #ident	"%Z%%M%	%I%	%E% SMI"
     26 #
     27 
     28 PATH="/usr/bin:/usr/sbin:${PATH}"
     29 export PATH
     30 
     31 add_self_identifying_entry() {
     32 cat >> $dest <<EOF
     33 
     34 #
     35 # The following stub node is needed for pathological bottom-up
     36 # devid resolution on a self-identifying transport. 
     37 #
     38 name="ssd" class="scsi-self-identifying";
     39 EOF
     40 }
     41 
     42 while read src dest; do
     43 	if [ ! -f $dest ]; then
     44 		cp $src $dest
     45 	else
     46 		# Remove obsoleted drivers
     47 		grep -v 'name="ssd" parent="SUNW,pln" port=' $dest > /tmp/d.$$
     48 		grep -v 'name="ssd" parent="scsi_vhci" target=0;' /tmp/d.$$ > /tmp/d.$$
     49 		mv /tmp/d.$$ $dest
     50 
     51 		# Process conf files for missing entries
     52 		while read confline; do
     53 			if echo "$confline" | egrep "^[\t| ]*#|^[\t| ]*$" > /dev/null; then
     54 				continue
     55 			fi
     56 
     57 			grep "$confline" $dest > /dev/null
     58 			if [ $? -ne 0 ]; then
     59 				echo $confline >> $dest
     60 			fi
     61 		done < $src
     62 		echo `cat $dest` | grep "scsi-self-identifying" > /dev/null
     63 
     64 		if [ $? -ne 0 ]; then
     65 			add_self_identifying_entry
     66 		fi
     67 	fi
     68 done
     69 
     70 exit 0
     71