postinstall revision 8a3c961b6b8e22607c570d092514b791eb1519e9
375N/A#! /usr/bin/sh
375N/A#
375N/A# CDDL HEADER START
375N/A#
375N/A# The contents of this file are subject to the terms of the
375N/A# Common Development and Distribution License (the "License").
375N/A# You may not use this file except in compliance with the License.
375N/A#
375N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
375N/A# or http://www.opensolaris.org/os/licensing.
375N/A# See the License for the specific language governing permissions
375N/A# and limitations under the License.
375N/A#
375N/A# When distributing Covered Code, include this CDDL HEADER in each
375N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
375N/A# If applicable, add the following below this CDDL HEADER, with the
375N/A# fields enclosed by brackets "[]" replaced with your own identifying
375N/A# information: Portions Copyright [yyyy] [name of copyright owner]
375N/A#
375N/A# CDDL HEADER END
3996N/A#
375N/A
375N/A#
375N/A# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
375N/A# Use is subject to license terms.
375N/A#
375N/A
375N/A# Driver info
375N/ADRV=rwn
844N/ADRVALIAS='"pci1814,781"'
844N/A
375N/ABASEDIR=${BASEDIR:-/}
1273N/A
375N/A# Function: check_add_drv()
375N/A#
375N/A# This function will check if add_drv has been executed.
375N/A# If not simply calls add_drv. Otherwise adds entries to
375N/A# driver_aliases, driver_classes and minor_perm if necessary.
375N/A# The syntax of this function is the same as add_drv.
375N/A
375N/Acheck_add_drv()
375N/A{
844N/A CMD="add_drv"
844N/A
375N/A ALIAS=""
3661N/A ALIASDIR="${BASEDIR}"/etc/driver_aliases
3661N/A while getopts i:b: opt 2>/dev/null; do
3661N/A case "$opt" in
814N/A i) CMD="${CMD} -i ${OPTARG}"
375N/A ALIAS=`echo ${OPTARG} | /usr/bin/sed -e "s/'//g"`
3996N/A ;;
3996N/A b) if [ "${OPTARG}" != "/" ]; then
3996N/A # On a client
375N/A # modify the sytem files and touch
375N/A # /reconfigure for reconfigure reboot
375N/A CMD="${CMD} -b \"${OPTARG}\""
375N/A fi
375N/A ;;
375N/A \?) echo "check_add_drv(): Unknown option $opt"
375N/A return
375N/A ;;
375N/A esac
375N/A done
375N/A shift `/usr/bin/expr ${OPTIND} - 1`
375N/A DRIVER=$1
375N/A CMD="${CMD} ${DRIVER}"
375N/A
375N/A # Make sure add_drv has not been previously executed
375N/A # before attempting to add the driver
375N/A /usr/bin/egrep -s "^${DRIVER}[ ]" "$BASEDIR"/etc/name_to_major
375N/A
375N/A if [ $? -ne 0 ]; then
375N/A eval ${CMD}
375N/A if [ $? -ne 0 ]; then
375N/A echo "Failed add_drv ${DRIVER}!\n" >&2
375N/A exit 1
375N/A fi
375N/A else
3996N/A # Add driver entry if necessary
3996N/A if [ -n "${ALIAS}" ]; then
for i in ${ALIAS}; do
/usr/bin/egrep -s "^${DRIVER}[ ]+$i" ${ALIASDIR}
if [ $? -ne 0 ]; then
echo "${DRIVER} $i" >> ${ALIASDIR}
fi
done
fi
fi
}
check_add_drv -b "${BASEDIR}" -i "'${DRVALIAS}'" ${DRV}