OpenSolaris_b135/pkgdefs/SUNWudapltr/postinstall

#!/bin/sh
#
#pragma ident	"%Z%%M%	%I%	%E% SMI"
#
# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

PATH="/usr/bin:/usr/sbin:${PATH}"
export PATH

#
# Driver info
#
DRV=daplt
DRVPERM='* 0644 root sys'

ADD_DRV=/usr/sbin/add_drv

#
# Select the correct add_drv options to execute.
# add_drv touches /reconfigure to cause the
# next boot to be a reconfigure boot.
#
if [ "${BASEDIR}" = "/" ]; then
	#
	# On a running system, modify the
	# system files and attach the driver
	#
	ADD_DRV_FLAGS=""
else     
	#
	# On a client, modify the system files
	# relative to BASEDIR
	#
	ADD_DRV_FLAGS="-b ${BASEDIR}"
fi	

#
# Make sure add_drv has not been previously executed
# before attempting to add the driver.
#
grep "^${DRV} " $BASEDIR/etc/name_to_major > /dev/null 2>&1
if [ $? -ne 0 ]; then
	${ADD_DRV} ${ADD_DRV_FLAGS} -m "${DRVPERM}" ${DRV}
	if [ $? -ne 0 ]; then
		echo "postinstall: add_drv $DRV failed\n" >&2
		exit 1
	fi
fi

#
# On a running system, register the service provider using datadm. 
# If on a client system, nothing more needs to be done here.
#
if [ "${BASEDIR}" = "/" ]; then
	DATCONF=/etc/dat/dat.conf
	SPCONF=/usr/share/dat/SUNWudaplt.conf
	DATADM=/usr/sbin/datadm
	${DATADM} -a ${SPCONF}
	if [ $? -eq 0 ]; then
		grep "driver_name=tavor" $DATCONF > /dev/null 2>&1
		if [ $? -ne 0 ]; then
			echo "Consult the Solaris System Admin Guide" \
			"on how to manually configure the uDAPL Service" \
			"Provider for Tavor"
		fi				
		exit 0
	else
		echo "datadm -a failed"
		exit 1
	fi
fi

exit 0