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