OpenSolaris_b135/pkgdefs/SUNWuedg/postinstall

#!/bin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#pragma ident	"%Z%%M%	%I%	%E% SMI"
#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
 
PATH="/usr/bin:/usr/sbin:${PATH}"
export PATH

if [ "${BASEDIR:=/}" != "/" ] 
then
	BASEDIR_OPT="-b $BASEDIR" 
fi

installed() {
	driver=$1
	grep "^${driver} " $BASEDIR/etc/name_to_major > /dev/null 2>&1

	return $?
}

update_driver() {
	driver=$1
	aliases=$2
	for alias in ${aliases}
	do
		egrep "^${driver}[ 	]+${alias}" ${BASEDIR}/etc/driver_aliases > /dev/null 2>&1
		if [ $? -ne 0 ]
		then
			echo "${driver} ${alias}" >> ${BASEDIR}/etc/driver_aliases
		fi
	done
}

EXIT=0

USBSER_EDGE_ALIASES="\
	\"usbif1608,1.config1.0\" \
	\"usbif1608,3.config1.0\" \
	\"usbif1608,4.config1.0\" \
	\"usbif1608,5.config1.0\" \
	\"usbif1608,6.config1.0\" \
	\"usbif1608,7.config1.0\" \
	\"usbif1608,c.config1.0\" \
	\"usbif1608,d.config1.0\" \
	\"usbif1608,e.config1.0\" \
       	\"usbif1608,f.config1.0\" \
	\"usbif1608,10.config1.0\" \
	\"usbif1608,11.config1.0\" \
	\"usbif1608,12.config1.0\" \
	\"usbif1608,13.config1.0\" \
	\"usbif1608,14.config1.0\" \
	\"usbif1608,201.config1.0\" \
	\"usbif1608,205.config1.0\" \
	\"usbif1608,206.config1.0\" \
	\"usbif1608,207.config1.0\" \
	\"usbif1608,20c.config1.0\" \
	\"usbif1608,20d.config1.0\" \
	\"usbif1608,215.config1.0\" \
	\"usbif1608,217.config1.0\" \
	\"usbif1608,21a.config1.0\" \
	\"usbif1608,240.config1.0\" \
	\"usbif1608,241.config1.0\" \
	\"usbif1608,242.config1.0\" \
	\"usbif1608,243.config1.0\" \
	\"usbif1608,244.config1.0\" \
	\"usbif1608,247.config1.0\" \
	\"usbif1608,1.100.config1.0\" \
	"

if installed usbser_edge ; then
	update_driver usbser_edge "${USBSER_EDGE_ALIASES}" || EXIT=1
else
	add_drv ${BASEDIR_OPT} -m '* 0666 root sys' \
	    -i "${USBSER_EDGE_ALIASES}" -n usbser_edge || \
	    EXIT=1
fi

exit $EXIT