#! /bin/sh

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

RTVC_ALIAS="SUNW,rtvc"

if [ "$BASEDIR" = "/" ]
then 	
    #
    # We're modifying the running kernel
    #
    if /usr/sbin/prtconf -vp | /bin/fgrep -s "$RTVC_ALIAS"
    then
        # de-install driver, just in case
        # de-install previous driver, just in case
        # This insures next reference to /dev/rtvc0 will cause
        #  driver to be reloaded from disk.
        # We can't do the obvious thing with rem_drv/add_drv since
        #  on patch backout we don't get a chance to run after the
        #  original driver is restored.


	sync
	modnum=`set -- \`/usr/sbin/modinfo | grep rtvc\`; echo $1`
	if [ "$modnum" ]
	then
             /usr/sbin/modunload -i $modnum && exit 0
        else
            exit 0
	fi

        ## fall thru if errors in above modunload ##
    fi
fi

#
# We're modifying a mounted kernel
#

touch ${BASEDIR}/reconfigure

if [ "$BASEDIR" = "/" ]
then
	echo >&2
	echo "NOTE: Reboot your system to re-load the SunVideo (RTVC) driver." >&2
	echo >&2
fi

exit 0

# Local Variables: ***
# mode:ksh ***
# End: ***
