#!/bin/sh
##
##
##  Description:  post-install script for SUNWscrdt installation
#
# ident	"@(#)postinstall	1.5	01/12/12 SMI"
#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#


ADD_DRV=/usr/sbin/add_drv
KERNEL_DIR=/usr/kernel/drv
KERNEL_MISC=/usr/kernel/misc
LN=/usr/bin/ln 
DEVDIR=/dev
DEVLINKS="/usr/sbin/devlinks"
DEVLINKS_TAB="/etc/devlink.tab"
GREP="/bin/grep"
CP="/bin/cp"

if [ ! -x $ADD_DRV ] ; then
    echo "Cannot find $ADD_DRV, aborting..."
    exit 1
fi

if [ ! -d $KERNEL_DIR ] ; then
    echo "The kernel directory $KERNEL_DIR is not there, aborting..."
    exit 1
fi

#
# Set up the devlinks.tab file so that when add_drv is run below,
# it'll run devlinks and create the /dev/rsmrdt symlink.
# Warning: the whitespace character after "rsmrdt" in the following
#          strings is a TAB, not spaces.  This is important.
#

DEVLINK_MODIFIED=`${GREP} "type=ddi_pseudo;name=rsmrdt	" ${DEVLINKS_TAB}`
if [ -z "$DEVLINK_MODIFIED" ]
then
	${CP} ${DEVLINKS_TAB} ${DEVLINKS_TAB}.prersmrdt
	echo "type=ddi_pseudo;name=rsmrdt	\M0" >> ${DEVLINKS_TAB}
	sync
fi

#
# Add the driver to the system 
#

echo " doing add_drv on rsmrdt driver..."
$ADD_DRV -m '* 0600 root root' -i 'SUNW,rsmrdt' rsmrdt

echo " loading clif_rsmrdt module... "
modload $KERNEL_MISC/clif_rsmrdt

exit 0

## EOF
