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