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