#! /bin/sh
#	@(#)postinstall	1.10 93/06/17 

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

RTVC_ALIAS="SUNW,rtvc"

# *** S4-93 hack ***
# If $BASEDIR isn't / (ie, we're doing a netinstall or a CD-ROM install)
# then update name_to_major, minor_perm, and devlink.tab by hand.
# otherwise, use add_drv.

if [ "$BASEDIR" = "/" ]
then 	
    #
    # We're modifying the running kernel
    #
    if /usr/sbin/prtconf -vp | /bin/fgrep -s "$RTVC_ALIAS"
    then
        # 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 load the patched SunVideo (RTVC) driver." >&2
	echo >&2
fi

exit 0

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