#!/bin/sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # PATH=/usr/bin:/usr/sbin:$PATH; export PATH PREFIX=/tmp/mptsas.conf.$$ add_comment_for_vhci_class() { if grep "^# The mpt_sas driver, as a pHCI driver" $1 > /dev/null 2>&1; then return fi cat >> $1 << EOF # # The mpt_sas driver, as a pHCI driver, must specify the vHCI class it # belongs to(scsi_vhci). # EOF } add_comment_for_mpxio_disable() { if grep "^# Global mpxio-disable property:" $1 > /dev/null 2>&1; then return fi cat >> $1 << EOF # # I/O multipathing feature (MPxIO) can be enabled or disabled using # mpxio-disable property. Setting mpxio-disable="no" will activate # I/O multipathing; setting mpxio-disable="yes" disables the feature. # # Global mpxio-disable property: # # To globally enable MPxIO on all LSI MPT SAS 2.0 controllers set: # mpxio-disable="no"; # # To globally disable MPxIO on all LSI MPT SAS 2.0 controllers set: # mpxio-disable="yes"; # # You can also enable or disable MPxIO on a per HBA basis. # Per HBA settings override the global setting for the specified HBAs. # To disable MPxIO on a controller whose parent is /pci@7c0/pci@0/pci@9 # and the unit-address is "0" set: # name="mpt_sas" parent="/pci@7c0/pci@0/pci@9" unit-address="0" mpxio-disable="yes"; # EOF } add_comment_for_tape_property() { if grep "^# The property tape" $1 > /dev/null 2>&1; then return fi cat >> $1 << EOF # # The property tape is only used for X86 # EOF } update_mptsasconf() { NEWHDR1=$PREFIX.hdr1 NEWHDR2=$PREFIX.hdr2 TMPFILE=$PREFIX.tmp # replace old copyright with new one HEADER="^#.* Copyright.*Sun Microsystems.*$" if grep "$HEADER" $1 > $NEWHDR1 2>/dev/null; then # replace / by \/ sed "s/\\//\\\\\\//g" $NEWHDR1 > $NEWHDR2 2>/dev/null if sed "s/$HEADER/`cat $NEWHDR2`/" $2 > $TMPFILE 2>/dev/null then cp $TMPFILE $2 fi fi if [ "$ARCH" = "i386" ]; then grep 'tape="sctp"' $2 > /dev/null 2>&1 if [ $? != 0 ] ; then add_comment_for_tape_property $2 echo 'tape="sctp";' >> $2 fi fi add_comment_for_vhci_class $2 # check for property named ddi-vhci-class grep '^ddi-vhci-class' $2 > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'ddi-vhci-class="scsi_vhci";' >> $2 fi add_comment_for_mpxio_disable $2 # check for property named mpxio-disable grep '^mpxio-disable' $2 > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'mpxio-disable="no";' >> $2 fi rm -f $NEWHDR1 $NEWHDR2 $TMPFILE } if read src dest; then if [ ! -f $dest ]; then cp $src $dest if [ "$ARCH" = "i386" ]; then # add property tape for i386 platform add_comment_for_tape_property $dest echo 'tape="sctp";' >> $dest fi else # upgrading solaris update_mptsasconf $src $dest fi fi exit 0