OpenSolaris_b135/pkgdefs/SUNWrds/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
#
#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#ident	"%Z%%M%	%I%	%E% SMI"
 
PATH="/usr/bin:/usr/sbin:/sbin:${PATH}"
export PATH
RDS_SOCK_ENTRY="        30      1       0       /dev/rds"
DRVPERM='* 0644 root sys'
IB_DEV_DIR="/devices/ib"

ADD_DRV="add_drv -b $BASEDIR"
if [ "${BASEDIR:=/}" = "/" ]
then
	ADD_DRV="add_drv"

	# Is there IB Hardware?
	if [ ! -d $IB_DEV_DIR ]
	then
		#
		# On a running system with NO IB hardware, modify the
		# system files only.
		#
		ADD_DRV_OPT="-n"
	fi
fi

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

EXIT=0

not_installed rds || $ADD_DRV -m "${DRVPERM}" rds || EXIT=1

not_installed rdsib || $ADD_DRV ${ADD_DRV_OPT} -m "${DRVPERM}" \
	rdsib || EXIT=1

# Check rds entry exists in sock2path
egrep "$RDS_SOCK_ENTRY" $BASEDIR/etc/inet/sock2path > /dev/null 2>&1
if [ $? -ne 0 ]
then
	echo "$RDS_SOCK_ENTRY" >> $BASEDIR/etc/inet/sock2path
	if [ "${BASEDIR:=/}" = "/" ]
	then
		soconfig $RDS_SOCK_ENTRY || EXIT=1
	fi
fi

exit $EXIT