postinstall revision 5c1d0199d69216ebefa9ed86940778f6d215a97f
080575042aba2197b425ebfd52061dea061a9aa1xy# CDDL HEADER START
080575042aba2197b425ebfd52061dea061a9aa1xy# The contents of this file are subject to the terms of the
080575042aba2197b425ebfd52061dea061a9aa1xy# Common Development and Distribution License (the "License").
080575042aba2197b425ebfd52061dea061a9aa1xy# You may not use this file except in compliance with the License.
080575042aba2197b425ebfd52061dea061a9aa1xy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
080575042aba2197b425ebfd52061dea061a9aa1xy# See the License for the specific language governing permissions
080575042aba2197b425ebfd52061dea061a9aa1xy# and limitations under the License.
080575042aba2197b425ebfd52061dea061a9aa1xy# When distributing Covered Code, include this CDDL HEADER in each
080575042aba2197b425ebfd52061dea061a9aa1xy# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
080575042aba2197b425ebfd52061dea061a9aa1xy# If applicable, add the following below this CDDL HEADER, with the
080575042aba2197b425ebfd52061dea061a9aa1xy# fields enclosed by brackets "[]" replaced with your own identifying
080575042aba2197b425ebfd52061dea061a9aa1xy# information: Portions Copyright [yyyy] [name of copyright owner]
080575042aba2197b425ebfd52061dea061a9aa1xy# CDDL HEADER END
080575042aba2197b425ebfd52061dea061a9aa1xy# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
080575042aba2197b425ebfd52061dea061a9aa1xy# Use is subject to license terms.
080575042aba2197b425ebfd52061dea061a9aa1xy# ident "%Z%%M% %I% %E% SMI"
080575042aba2197b425ebfd52061dea061a9aa1xy# Function: check_add_drv()
080575042aba2197b425ebfd52061dea061a9aa1xy# This function will check if the module has an entry in etc/name_to_major
080575042aba2197b425ebfd52061dea061a9aa1xy# If not simply calls add_drv with the arguments given. If there is
080575042aba2197b425ebfd52061dea061a9aa1xy# such an entry in name_to_major file, it adds entries in driver_aliases
080575042aba2197b425ebfd52061dea061a9aa1xy# driver_classes and minor_perm if necessary.
080575042aba2197b425ebfd52061dea061a9aa1xy# The syntax of this function is the same as add_drv.
080575042aba2197b425ebfd52061dea061a9aa1xy while getopts i:b:m:c:N opt
080575042aba2197b425ebfd52061dea061a9aa1xy /usr/bin/grep "^$drvname[ ]" $BASEDIR/etc/name_to_major > /dev/null 2>&1
080575042aba2197b425ebfd52061dea061a9aa1xy # NB: We really would have liked to use update_drv here, but
080575042aba2197b425ebfd52061dea061a9aa1xy # since we can't do that (see CR 6281386), we have this code.
080575042aba2197b425ebfd52061dea061a9aa1xy # Note that if we've never added this driver before, the add_drv
080575042aba2197b425ebfd52061dea061a9aa1xy # below takes care of worrying about conflicting entries in
080575042aba2197b425ebfd52061dea061a9aa1xy # /etc/driver_aliases. (It will fail if there is a conflicting
080575042aba2197b425ebfd52061dea061a9aa1xy # entry already in name_to_major, add alias, class, minorperm
080575042aba2197b425ebfd52061dea061a9aa1xy /usr/bin/egrep "^$drvname[ ]+$i" $BASEDIR/etc/driver_aliases>/dev/null 2>&1
080575042aba2197b425ebfd52061dea061a9aa1xy if [ $? -ne 0 ]
080575042aba2197b425ebfd52061dea061a9aa1xy /usr/bin/egrep "^$drvname[ ]+$class( | |$)" $BASEDIR/etc/driver_classes > /dev/null 2>&1
080575042aba2197b425ebfd52061dea061a9aa1xy if [ $? -ne 0 ]
080575042aba2197b425ebfd52061dea061a9aa1xy /usr/bin/grep "^$drvname:" $BASEDIR/etc/minor_perm > /dev/null 2>&1
080575042aba2197b425ebfd52061dea061a9aa1xy if [ $? -ne 0 ]
080575042aba2197b425ebfd52061dea061a9aa1xy# Okay, so 128h is not a legal PCI vendor id. But apparently some SPARC
080575042aba2197b425ebfd52061dea061a9aa1xy# firmware creates the node with this id. Not sure why, possibly it is
080575042aba2197b425ebfd52061dea061a9aa1xy# a firmware bug, possibly it was intended to prevent the driver from
080575042aba2197b425ebfd52061dea061a9aa1xy# being used with 3rd party NICs. Whatever the reason, it isn't relevant
080575042aba2197b425ebfd52061dea061a9aa1xy# anymore, but we still have to support the old node.
080575042aba2197b425ebfd52061dea061a9aa1xy -i '"pci128h,9102" "pci108e,9102" "pci1282,9102"' \