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