#
# $Source: /project/fspro/src/unix/common/cmd/common/isis/provider/fspro.sh,v $
# $Id: fspro.sh,v 1.79.2.8 2004/02/13 18:54:51 murthy Exp $
# $Copyrights: Copyright (c) 2001 - 2004 VERITAS Software Corporation.
# All rights reserved.
# VERITAS, the VERITAS Logo and all other VERITAS product names and
# slogans are trademarks or registered trademarks of VERITAS Software
# Corporation. VERITAS and the VERITAS Logo Reg. U.S. Pat. & Tm. Off.
# Other product names and/or slogans mentioned herein may be trademarks or
# registered trademarks of their respective companies.
#
# UNPUBLISHED - RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF THE UNITED
# STATES.  USE OF A COPYRIGHT NOTICE IS PRECAUTIONARY ONLY AND DOES NOT
# IMPLY PUBLICATION OR DISCLOSURE.
#
# THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE SECRETS OF
# VERITAS SOFTWARE.  USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED WITHOUT
# THE PRIOR EXPRESS WRITTEN PERMISSION OF VERITAS SOFTWARE.
#
# The Licensed Software and Documentation are deemed to be "commercial
# computer software" and "commercial computer software documentation" as
# defined in FAR Sections 12.212 and DFARS Section 227.7202.  $
#

#
# VERITAS Object Bus Registry file paramaters
#

#############################################################################
# globals for VRTSob package and VRTSfspro package
#############################################################################
CMDLOG=/var/vx/isis/command.log
OBREGBASE=/opt/VRTSob
FSPROREGBASE=/opt/VRTSfspro

#############################################################################
# Solaris packaging/patching for jump start compliance needs some
# specific environment variables to be used. Since jumpstart packaging &
# jumpstart patching do not seem to use the same vars, some workarounds
# would be needed. BASEDIR would be set to pkginfo's ROOTDIR in pkgadd/pkgrm
# by the time we get here (in postinstall and postremove). Since we use this
# script for patches also, by the time we get here in in patchadd/patchrm
# (in postbackout and prebackout), BASEDIR does not seem to be set. So
# if BASEDIR is NOT set, we assume we are patch paths and if its set
# we assume we are in pkg paths (hacky!). And since our package base
# is always relative to '/', we will set BASEDIR to "$ROOTDIR/" in the
# patch paths. The trailing '/' will work even if -R is not specified,
# in which case ROOTDIR would be NULL. (ROOTDIR is patch equivalent of
# PKG_INSTALL_ROOT).
#############################################################################
OS_PLAT=`uname -s`
if [ $OS_PLAT = SunOS -o $OS_PLAT = Solaris ]; then
	if [ "$BASEDIR" = "" ]; then
#		We MUST have been in the patch paths, since this is
#		always set in pkg paths by the time we get here.
		PKG_INSTALL_ROOT=$ROOTDIR
		BASEDIR=$ROOTDIR/
	fi
	. $BASEDIR/opt/VRTSfspro/config/ce_guids.sh
	OBBASE=$PKG_INSTALL_ROOT/opt/VRTSob
	FSPROBASE=$BASEDIR/opt/VRTSfspro
	REGFILE=$PKG_INSTALL_ROOT/etc/vx/isis/Registry
	if [ -n "$PKG_INSTALL_ROOT" ]; then
		PKGINFO="pkginfo -R $PKG_INSTALL_ROOT"
	else
		PKGINFO="pkginfo"
	fi
else
	. /opt/VRTSfspro/config/ce_guids.sh
	OBBASE=/opt/VRTSob
	FSPROBASE=/opt/VRTSfspro
	REGFILE=/etc/vx/isis/Registry
fi
REGOPS=$OBBASE/bin/vxregctl
OBJTYPOPS=$OBBASE/bin/vxobjecttype
VXSVC=$OBBASE/bin/vxsvc

#############################################################################
# Message GUID for all OSes
#############################################################################
FSMSGGUID="dbb2b048-1dd1-11b2-be9e-080020b057b0"
FSMSGGUID_version="1.2"
VXMSGGUID="e8319d66-1dd1-11b2-be9e-080020b057b0"
VXMSGGUID_version="1.2"
FSMSGKEY=Software/VERITAS/VxSvc/CurrentVersion/MessageCatalogs/{$FSMSGGUID}/IsisSkin/1/1033
VXMSGKEY=Software/VERITAS/VxSvc/CurrentVersion/MessageCatalogs/{$VXMSGGUID}/IsisSkin/1/1033

#############################################################################
# Search Extension GUID for all OSes
#############################################################################
CLIENT_EXT_VxSearchCE="27312042-1dd2-11b2-840a-080020a6bb38"
CLIENT_EXT_VxSearchCE_version="1.5"
CLIENT_EXT_VxSearchCERS="eba32058-1dd1-11b2-840b-080020a6bb38"
CLIENT_EXT_VxSearchCERS_version="1.5"

#############################################################################
# Older Search Extension GUID's for all OSes
#############################################################################
CLIENT_EXT_VxSearchCE_old2="f96b881e-1dd1-11b2-968d-080020b057b0"
CLIENT_EXT_VxSearchCE_old3="b78c1c2a-1dd1-11b2-87a7-080020c06f6c"

#############################################################################
# Security stuff
#############################################################################
ACCESSGROUPS="vrtsadm"
ACCESSUSERS=""

#############################
# Provider paramaters
#############################
INSTALLKEY=Software/VERITAS/VxSvc/CurrentVersion/InstalledProducts/VRTSfspro
FSKEY=Software/VERITAS/VxSvc/CurrentVersion/Providers/osfs_provider
VXKEY=Software/VERITAS/VxSvc/CurrentVersion/Providers/vxfs_provider
SKEY=Software/VERITAS/VxSvc/CurrentVersion/Providers/searchprovider

#############################
# Client Extension paramaters
#############################
GUIKEY=Software/VERITAS/VxSvc/CurrentVersion/ClientExtensions
GUIKEY_VxFsCE=Software/VERITAS/VxSvc/CurrentVersion/ClientExtensions/{$CLIENT_EXT_VxFsCE}/IsisSkin/1/1033
GUIKEY_VxFsRS=Software/VERITAS/VxSvc/CurrentVersion/ClientExtensions/{$CLIENT_EXT_VxFsRS}
GUIKEY_VxFsRS_VxFsResourceBundle_en=$GUIKEY_VxFsRS/IsisSkin/1/1033
GUIKEY_VxFsVmRS=Software/VERITAS/VxSvc/CurrentVersion/ClientExtensions/{$CLIENT_EXT_VxFsVmRS}
GUIKEY_VxFsVmRS_VxFsResourceBundle_en=$GUIKEY_VxFsVmRS/IsisSkin/1/1033
GUIKEY_VxFsVmLibRS=Software/VERITAS/VxSvc/CurrentVersion/ClientExtensions/{$CLIENT_EXT_VxFsVmLibRS}
GUIKEY_VxFsVmLibRS_VxFsResourceBundle_en=$GUIKEY_VxFsVmLibRS/IsisSkin/1/1033
GUIKEY_VxFsOneguiRS=Software/VERITAS/VxSvc/CurrentVersion/ClientExtensions/{$CLIENT_EXT_VxFsOneguiRS}
GUIKEY_VxFsOneguiRS_VxFsOneguiResourceBundle_en=$GUIKEY_VxFsOneguiRS/IsisSkin/1/1033
GUIKEY_VxFsHelp=Software/VERITAS/VxSvc/CurrentVersion/ClientExtensions/{$CLIENT_EXT_VxFsHelp}
GUIKEY_VxFsHelp_en=$GUIKEY_VxFsHelp/IsisSkin/1/1033

#############################
# Search Extension paramaters
#############################
GUIKEY_VxSearchCE=Software/VERITAS/VxSvc/CurrentVersion/ClientExtensions/{$CLIENT_EXT_VxSearchCE}/IsisSkin/1/1033
GUIKEY_VxSearchCERS=Software/VERITAS/VxSvc/CurrentVersion/ClientExtensions/{$CLIENT_EXT_VxSearchCERS}/IsisSkin/1/1033

bumpup_version()
{
	integer_part=`echo $1|cut -f 1,3 -d .`
	decimal_part=`echo $1|sed -e "s/$integer_part\.//"`
	up_decimal_part=`expr $decimal_part + 1`

	echo "$integer_part.$up_decimal_part"
}

bumpdown_version()
{
	integer_part=`echo $1|cut -f 1,3 -d .`
	decimal_part=`echo $1|sed -e "s/$integer_part\.//"`

	if [ $decimal_part != "0" ]
	then
		down_decimal_part=`expr $decimal_part - 1`
	else
		# This should never happen. Hoever wish we have started
		# the version at least at X.1 instead of X.0. 
		down_decimal_part=$decimal_part
	fi

	echo "$integer_part.$down_decimal_part"
}

message()
{
	$_ECHO "$@"
}

error()
{
	if [ $OS_PLAT = HP-UX -o $OS_PLAT = hpux ]; then
		$_ECHO "ERROR:   $@"
	else
		$_ECHO "         $@"
	fi
}

warning()
{
	if [ $OS_PLAT = HP-UX -o $OS_PLAT = hpux ]; then
		$_ECHO "WARNING: $@"
	else
		$_ECHO "         $@"
	fi
}


note()
{
	if [ $OS_PLAT = HP-UX -o $OS_PLAT = hpux ]; then
		$_ECHO "NOTE:    $@"
	else
		$_ECHO "         $@"
	fi
}

fatalexit()
{
	[ "$verbose" = "yes" ] && \
		error "Please fix the problem and re-run this script."
	exit 1
}

usage()
{
	if [ "$prt_usage" = "yes" ]
	then
		error "Usage:  fspro.sh [-f|v|p] { add | remove | patchadd | patchrm }"
		exit 1
	fi
}

##############################################################################
# function to register the fs provider to VIP                                #
##############################################################################
fspro_register()
{
    if [ ! -f $FSPROBASE/lib/osfs_provider.$SHLIB_EXT ]
    then
	[ "$verbose" = "yes" -o "$prt_error_only" = "yes" ] && \
	error "VRTSfspro installation terminated; This VRTSfspro package
         does not contain a VRTSfspro library for this version of VxFS."
	fatalexit
    fi

    if [ ! -f $FSPROBASE/lib/vxfs_provider.$SHLIB_EXT ]
    then
	[ "$verbose" = "yes" -o "$prt_error_only" = "yes" ] && \
	error "VRTSfspro installation terminated; This VRTSfspro package
         does not contain a VRTSfspro library for this version of VxFS."
	fatalexit
    fi

    if [ ! -x $REGOPS -o ! -x $OBJTYPOPS -o ! -f $REGFILE ] 
    then
	[ "$verbose" = "yes" -o "$prt_error_only" = "yes" ] && \
	error "Can not locate the VEA utilities. Please fix this problem and
	 then reattempt this configuration removal.
 
         Aborting VRTSfspro configuration installation attempt."
	exit 3
    fi

    #### VxSearchCE.jar
    FLAGS_VxSearchCE=1

    #
    # update VERITAS Object Bus registry file
    #
    [ "$verbose" = "yes" ] && \
		note "Adding VRTSfspro to VEA Registry ... \c"

    cp $REGFILE $REGFILE.pre-fspro

    ##########################
    # adding the fsprovider library security entry
    ##########################
    SECURITY_KEY=Software/VERITAS/VxSvc/CurrentVersion/Security
    ACCESSGROUPS="vrtsadm"

    $REGOPS $REGFILE queryvalue $SECURITY_KEY AccessUsers > /dev/null 2>&1 
    if [ $? != 0 ] 
    then 
	    $REGOPS $REGFILE createkey $SECURITY_KEY > /dev/null 2>&1
	    $REGOPS $REGFILE setvalue $SECURITY_KEY AccessUsers REG_SZ "" > /dev/null 2>&1
    fi

    $REGOPS $REGFILE queryvalue $SECURITY_KEY AccessGroups > /dev/null 2>&1 
    if [ $? != 0 ] 
    then 
	    $REGOPS $REGFILE createkey $SECURITY_KEY > /dev/null 2>&1
	    $REGOPS $REGFILE setvalue $SECURITY_KEY AccessGroups REG_SZ $ACCESSGROUPS > /dev/null 2>&1
    fi
    ##########################
    # adding the fsprovider log file, only add it if not there.
    ##########################
    CMDLOGKEY=Software/VERITAS/VxSvc/CurrentVersion
    $REGOPS $REGFILE queryvalue $CMDLOGKEY CommandLog > /dev/null 2>&1
    if [ $? != 0 ]
    then
           mkdir -p $PKG_INSTALL_ROOT/`dirname $CMDLOG`
           touch $PKG_INSTALL_ROOT/$CMDLOG
           $REGOPS $REGFILE setvalue $CMDLOGKEY CommandLog REG_SZ $CMDLOG
    fi

    ##########################
    # adding the task persistance, only add it if not there.
    ##########################
    PERSISTKEY=Software/VERITAS/VxSvc/CurrentVersion
    PESISTTASKS=1
    $REGOPS $REGFILE queryvalue $PERSISTKEY PersistTasks > /dev/null 2>&1
    if [ $? != 0 ]
    then
           $REGOPS $REGFILE setvalue $PERSISTKEY PersistTasks REG_INT $PESISTTASKS
    fi

    ##########################
    # adding key into InstalledProducts
    ##########################
    $REGOPS $REGFILE createkey $INSTALLKEY

    ##########################
    # adding the search provider library entry
    ##########################
    # We don't know where to put the search provider so put it in the VIP
    # library area. So also we don't know where to put the search CE so
    # put it in the VIP extensions area. And even if they already exist,
    # we will overwrite. Uninstall will not remove them though
    ##########################
    mkdir -p $OBBASE/extensions/VxSearch/IsisSkin/java/1033 2>/dev/null
    cp $FSPROBASE/extensions/VxSearchCE.jar $OBBASE/extensions/VxSearch/IsisSkin/java/1033/VxSearchCE.jar
    cp $FSPROBASE/extensions/SearchResourceBundle.en.jar $OBBASE/extensions/VxSearch/IsisSkin/java/1033/SearchResourceBundle.en.jar

    # For some reason, even if vxsvc is not running, aix's cp complains
    # that "Cannot open or remove a file containing  running program".
    # We will shut it off by redireting it to /dev/null
    cp $FSPROBASE/lib/searchprovider.$SHLIB_EXT $OBBASE/lib/searchprovider.$SHLIB_EXT 2>/dev/null

    ##########################
    # Before we add search provider library we should nuke its existing
    # client extention entries. If we add the provider entry first, we
    # can not query for its extension since addition would replace
    # what it was. And also its possible that there are multiple seach
    # extension entries that lingered on. We will clean them too now on. 
    ##########################
    CLIENT_EXT_VxSearchCE_old1=`$REGOPS queryvalue $SKEY ClientExtension 2>/dev/null | awk '{print $5}'|sed -e "s/{//g"|sed -e "s/}//g"`
    $REGOPS $REGFILE deletekeyrecursive $GUIKEY/{$CLIENT_EXT_VxSearchCE_old1} 2>/dev/null
    $REGOPS $REGFILE deletekeyrecursive $GUIKEY/{$CLIENT_EXT_VxSearchCE_old2} 2>/dev/null
    $REGOPS $REGFILE deletekeyrecursive $GUIKEY/{$CLIENT_EXT_VxSearchCE_old3} 2>/dev/null

    $REGOPS $REGFILE createkey $SKEY
    $REGOPS $REGFILE setvalue $SKEY ImageFile REG_SZ $OBREGBASE/lib/searchprovider.$SHLIB_EXT
    $REGOPS $REGFILE setvalue $SKEY ClientExtension REG_SZ {$CLIENT_EXT_VxSearchCE}

    ######################
    # adding the fspro library entry
    ######################
    $REGOPS $REGFILE createkey $FSKEY
    $REGOPS $REGFILE setvalue $FSKEY ImageFile REG_SZ $FSPROREGBASE/lib/osfs_provider.$SHLIB_EXT
    $REGOPS $REGFILE setvalue $FSKEY ClientExtension REG_SZ {$CLIENT_EXT_VxFsCE}
    $REGOPS $REGFILE setvalue $FSKEY DependsOn REG_SZ "vxvmprovider"

    ######################
    # Currently On AIX VxVM does not support jfs/jfs2
    ######################
    case $OS_PLAT in
    AIX | aix)
    	$REGOPS $REGFILE setvalue $FSKEY SupportedFS REG_SZ "vxfs"
        ;;

    esac
 
    ######################
    # adding the vxfspro library entry
    ######################
    $REGOPS $REGFILE createkey $VXKEY
    $REGOPS $REGFILE setvalue $VXKEY ImageFile REG_SZ $FSPROREGBASE/lib/vxfs_provider.$SHLIB_EXT
    $REGOPS $REGFILE setvalue $VXKEY ClientExtension REG_SZ {$CLIENT_EXT_VxFsCE}
    $REGOPS $REGFILE setvalue $VXKEY StrictDependsOn REG_SZ osfs_provider
    $REGOPS $REGFILE setvalue $VXKEY DependsOn REG_SZ "vxvmprovider"
 
    ######################
    # adding the fspro msg catalog entry
    ######################
    $REGOPS $REGFILE setvalue $FSKEY MessageCatalog REG_SZ {$FSMSGGUID}
    $REGOPS $REGFILE createkey $FSMSGKEY
    $REGOPS $REGFILE setvalue $FSMSGKEY ImageFile REG_SZ $FSPROREGBASE/msgcats/system/IsisSkin/java/1033/osfs.1033.cat
    $REGOPS $REGFILE setvalue $FSMSGKEY Version REG_SZ $FSMSGGUID_version
 
    ######################
    # adding the vxfspro msg catalog entry
    ######################
    $REGOPS $REGFILE setvalue $VXKEY MessageCatalog REG_SZ {$VXMSGGUID}
    $REGOPS $REGFILE createkey $VXMSGKEY
    $REGOPS $REGFILE setvalue $VXMSGKEY ImageFile REG_SZ $FSPROREGBASE/msgcats/system/IsisSkin/java/1033/vxfs.1033.cat
    $REGOPS $REGFILE setvalue $VXMSGKEY Version REG_SZ $VXMSGGUID_version
 
    ######################
    # adding the client extension entries
    ######################
    #
    #### VxSearchCE.jar
    $REGOPS $REGFILE createkey $GUIKEY_VxSearchCE
    $REGOPS $REGFILE setvalue $GUIKEY/{$CLIENT_EXT_VxSearchCE} SymbolicName REG_SZ VxSearchCE
    $REGOPS $REGFILE setvalue $GUIKEY_VxSearchCE ImageFile REG_SZ $OBREGBASE/extensions/VxSearch/IsisSkin/java/1033/VxSearchCE.jar
    $REGOPS $REGFILE setvalue $GUIKEY_VxSearchCE Flags REG_INT $FLAGS_VxSearchCE;
    $REGOPS $REGFILE setvalue $GUIKEY_VxSearchCE Version REG_SZ $CLIENT_EXT_VxSearchCE_version
    $REGOPS $REGFILE setvalue $GUIKEY_VxSearchCE StrictDependsOn REG_SZ "SearchResourceBundle";
 
    #### SearchResourceBundle.en.jar
    $REGOPS $REGFILE createkey $GUIKEY_VxSearchCERS
    $REGOPS $REGFILE setvalue $GUIKEY/{$CLIENT_EXT_VxSearchCERS} SymbolicName REG_SZ SearchResourceBundle
    $REGOPS $REGFILE setvalue $GUIKEY_VxSearchCERS ImageFile REG_SZ $OBREGBASE/extensions/VxSearch/IsisSkin/java/1033/SearchResourceBundle.en.jar
    $REGOPS $REGFILE setvalue $GUIKEY_VxSearchCERS Version REG_SZ $CLIENT_EXT_VxSearchCERS_version
 
    #### VxFsCE.jar
    $REGOPS $REGFILE createkey $GUIKEY_VxFsCE
    $REGOPS $REGFILE setvalue $FSKEY ClientExtension REG_SZ {$CLIENT_EXT_VxFsCE}
     $REGOPS $REGFILE setvalue $GUIKEY/{$CLIENT_EXT_VxFsCE} SymbolicName REG_SZ VxFsCE
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsCE ImageFile REG_SZ $FSPROREGBASE/extensions/VxFsCE.jar
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsCE Version REG_SZ $CLIENT_EXT_VxFsCE_version
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsCE StrictDependsOn REG_SZ "VxFsResourceBundle, VxSearchCE, VxFsVmResourceBundle, VxFsVmLibResourceBundle, VxFsOneguiResourceBundle, VxFsHelp";
 
    #### FS Resource Bundles
    $REGOPS $REGFILE createkey $GUIKEY_VxFsRS
    $REGOPS $REGFILE setvalue $GUIKEY/{$CLIENT_EXT_VxFsRS} SymbolicName REG_SZ VxFsResourceBundle
    $REGOPS $REGFILE createkey $GUIKEY_VxFsRS_VxFsResourceBundle_en
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsRS_VxFsResourceBundle_en ImageFile REG_SZ $FSPROREGBASE/extensions/VxFsResourceBundle.en.jar
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsRS_VxFsResourceBundle_en Version REG_SZ $CLIENT_EXT_VxFsRS_version
 
    $REGOPS $REGFILE createkey $GUIKEY_VxFsVmRS
    $REGOPS $REGFILE setvalue $GUIKEY/{$CLIENT_EXT_VxFsVmRS} SymbolicName REG_SZ VxFsVmResourceBundle
    $REGOPS $REGFILE createkey $GUIKEY_VxFsVmRS_VxFsResourceBundle_en
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsVmRS_VxFsResourceBundle_en ImageFile REG_SZ $FSPROREGBASE/extensions/VxFsVmResourceBundle.en.jar
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsVmRS_VxFsResourceBundle_en Version REG_SZ $CLIENT_EXT_VxFsVmRS_version

    $REGOPS $REGFILE createkey $GUIKEY_VxFsVmLibRS
    $REGOPS $REGFILE setvalue $GUIKEY/{$CLIENT_EXT_VxFsVmLibRS} SymbolicName REG_SZ VxFsVmLibResourceBundle
    $REGOPS $REGFILE createkey $GUIKEY_VxFsVmLibRS_VxFsResourceBundle_en
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsVmLibRS_VxFsResourceBundle_en ImageFile REG_SZ $FSPROREGBASE/extensions/VxFsVmLibResourceBundle.en.jar
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsVmLibRS_VxFsResourceBundle_en Version REG_SZ $CLIENT_EXT_VxFsVmLibRS_version

    $REGOPS $REGFILE createkey $GUIKEY_VxFsOneguiRS
    $REGOPS $REGFILE setvalue $GUIKEY/{$CLIENT_EXT_VxFsOneguiRS} SymbolicName REG_SZ VxFsOneguiResourceBundle
    $REGOPS $REGFILE createkey $GUIKEY_VxFsOneguiRS_VxFsOneguiResourceBundle_en
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsOneguiRS_VxFsOneguiResourceBundle_en ImageFile REG_SZ $FSPROREGBASE/extensions/VxFsOneguiResourceBundle.en.jar
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsOneguiRS_VxFsOneguiResourceBundle_en Version REG_SZ $CLIENT_EXT_VxFsOneguiRS_version

    $REGOPS $REGFILE createkey $GUIKEY_VxFsHelp
    $REGOPS $REGFILE setvalue $GUIKEY/{$CLIENT_EXT_VxFsHelp} SymbolicName REG_SZ VxFsHelp
    $REGOPS $REGFILE createkey $GUIKEY_VxFsHelp_en
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsHelp_en ImageFile REG_SZ $FSPROREGBASE/extensions/VxFsHelp.en.jar
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsHelp_en Version REG_SZ $CLIENT_EXT_VxFsHelp_version

    [ "$verbose" = "yes" ] && echo " done"
 
    rm -rf $REGFILE.pre-fspro 2>/dev/null

    [ "$verbose" = "yes" ] && [ "$restart_vxsvc" = "yes" ] && echo
    [ "$verbose" = "yes" ] && [ "$restart_vxsvc" = "yes" ] && \
	note "To use the VRTSfspro you must restart the VEA server.
         Refer to the man page for vxsvc(1M)."

    [ "$verbose" = "yes" ] && echo
    [ "$verbose" = "yes" ] && \
		note "VRTSfspro configuration installation complete.\n"
}

fspro_unregister()
{
    #
    # update Object Bus Registry file to remove VRTSfspro configuration info.
    #
    [ "$verbose" = "yes" ] && echo
    [ "$verbose" = "yes" ] && \
		note "Removing VRTSfspro from VEA Registry ... \c"

    cp $REGFILE $REGFILE.pre-fspro

    #############################
    # Provider paramaters
    #############################
    FSMSGKEY2=Software/VERITAS/VxSvc/CurrentVersion/MessageCatalogs/{$FSMSGGUID}/IsisSkin/1
    FSMSGKEY3=Software/VERITAS/VxSvc/CurrentVersion/MessageCatalogs/{$FSMSGGUID}/IsisSkin
    FSMSGKEY4=Software/VERITAS/VxSvc/CurrentVersion/MessageCatalogs/{$FSMSGGUID}

    VXMSGKEY2=Software/VERITAS/VxSvc/CurrentVersion/MessageCatalogs/{$VXMSGGUID}/IsisSkin/1
    VXMSGKEY3=Software/VERITAS/VxSvc/CurrentVersion/MessageCatalogs/{$VXMSGGUID}/IsisSkin
    VXMSGKEY4=Software/VERITAS/VxSvc/CurrentVersion/MessageCatalogs/{$VXMSGGUID}

    if [ ! -x $REGOPS -o ! -x $OBJTYPOPS -o ! -f $REGFILE ] 
    then
	[ "$verbose" = "yes" -o "$prt_error_only" = "yes" ] && \
	error "Can not locate the VEA utilities. Please fix this problem and
	 then reattempt this configuration removal.
 
         Aborting VRTSfspro configuration removal attempt."
	exit 3
    fi

    # Remove the registry entries that had been created at the time of
    # postinstall.

    ##########################
    # remove key from InstalledProducts
    ##########################
    $REGOPS $REGFILE deletekey $INSTALLKEY 2>/dev/null

    ##############################
    # remove the fspro entry
    ##############################
    $REGOPS $REGFILE deletekey $FSKEY 2>/dev/null

    ##############################
    # remove the fspro msg catalog entry
    ##############################
    $REGOPS $REGFILE deletekey $FSMSGKEY 2>/dev/null
    $REGOPS $REGFILE deletekey $FSMSGKEY2 2>/dev/null
    $REGOPS $REGFILE deletekey $FSMSGKEY3 2>/dev/null
    $REGOPS $REGFILE deletekey $FSMSGKEY4 2>/dev/null

    ##############################
    # remove the vxfspro entry
    ##############################
    $REGOPS $REGFILE deletekey $VXKEY 2>/dev/null

    ##############################
    # remove the vxfspro msg catalog entry
    ##############################
    $REGOPS $REGFILE deletekey $VXMSGKEY 2>/dev/null
    $REGOPS $REGFILE deletekey $VXMSGKEY2 2>/dev/null
    $REGOPS $REGFILE deletekey $VXMSGKEY3 2>/dev/null
    $REGOPS $REGFILE deletekey $VXMSGKEY4 2>/dev/null

    ##############################
    # remove the client extensions entries
    ##############################
    #### VxFsCE.jar
    $REGOPS $REGFILE deletekeyrecursive $GUIKEY/{$CLIENT_EXT_VxFsCE} 2>/dev/null

    ##############################
    # remove the client extensions resource bundles. we do not have the
    # the luxury of using deleterecursive for resource bundles that
    # could be localized. if we do so, we will blow their top level key
    # too. if a VRTSmufsp instance exists, if we use deleterecursive
    # and blow the VRTSfspro first, then when we uninstall VRTSmufsp
    # later, it will complain registry corruption. in oder to allow
    # uninstalls of these two pkgs, we go a lot of distance to allow
    # it. deleterecursive will undo such effort. why be lazy? lets type
    # some lines!!!
    ##############################
    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsRS}/IsisSkin/1/1033 ImageFile 2>/dev/null
    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsRS}/IsisSkin/1/1033 Version 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsRS}/IsisSkin/1/1033 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsRS}/IsisSkin/1 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsRS}/IsisSkin 2>/dev/null
    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsRS} SymbolicName 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsRS} 2>/dev/null

    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsVmRS}/IsisSkin/1/1033 ImageFile 2>/dev/null
    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsVmRS}/IsisSkin/1/1033 Version 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsVmRS}/IsisSkin/1/1033 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsVmRS}/IsisSkin/1 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsVmRS}/IsisSkin 2>/dev/null
    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsVmRS} SymbolicName 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsVmRS} 2>/dev/null

    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsVmLibRS}/IsisSkin/1/1033 ImageFile 2>/dev/null
    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsVmLibRS}/IsisSkin/1/1033 Version 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsVmLibRS}/IsisSkin/1/1033 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsVmLibRS}/IsisSkin/1 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsVmLibRS}/IsisSkin 2>/dev/null
    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsVmLibRS} SymbolicName 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsVmLibRS} 2>/dev/null

    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsOneguiRS}/IsisSkin/1/1033 ImageFile 2>/dev/null
    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsOneguiRS}/IsisSkin/1/1033 Version 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsOneguiRS}/IsisSkin/1/1033 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsOneguiRS}/IsisSkin/1 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsOneguiRS}/IsisSkin 2>/dev/null
    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsOneguiRS} SymbolicName 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsOneguiRS} 2>/dev/null

    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsHelp}/IsisSkin/1/1033 ImageFile 2>/dev/null
    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsHelp}/IsisSkin/1/1033 Version 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsHelp}/IsisSkin/1/1033 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsHelp}/IsisSkin/1 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsHelp}/IsisSkin 2>/dev/null
    $REGOPS $REGFILE deletevalue $GUIKEY/{$CLIENT_EXT_VxFsHelp} SymbolicName 2>/dev/null
    $REGOPS $REGFILE deletekey $GUIKEY/{$CLIENT_EXT_VxFsHelp} 2>/dev/null

    [ "$verbose" = "yes" ] && echo " done"

    rm -rf $REGFILE.pre-fspro 2>/dev/null

    [ "$verbose" = "yes" ] && [ "$restart_vxsvc" = "yes" ] && echo
    [ "$verbose" = "yes" ] && [ "$restart_vxsvc" = "yes" ] && \
	note "To effect this removal you must restart the VEA server.
         Refer to the man page for vxsvc(1M)."

    [ "$verbose" = "yes" ] && echo
    [ "$verbose" = "yes" ] && \
		note "VRTSfspro configuration removal complete."
    [ "$verbose" = "yes" ] && echo
}

##############################################################################
# function to patchadd the fs provider to VEA                                #
##############################################################################
fspro_patchadd()
{
    if [ ! -f $FSPROBASE/lib/osfs_provider.$SHLIB_EXT ]
    then
	[ "$verbose" = "yes" -o "$prt_error_only" = "yes" ] && \
	error "VRTSfspro installation terminated; This VRTSfspro package
         does not contain a VRTSfspro library for this version of VxFS."
	fatalexit
    fi

    if [ ! -f $FSPROBASE/lib/vxfs_provider.$SHLIB_EXT ]
    then
	[ "$verbose" = "yes" -o "$prt_error_only" = "yes" ] && \
	error "VRTSfspro installation terminated; This VRTSfspro package
         does not contain a VRTSfspro library for this version of VxFS."
	fatalexit
    fi

    if [ ! -x $REGOPS -o ! -x $OBJTYPOPS -o ! -f $REGFILE ] 
    then
	[ "$verbose" = "yes" -o "$prt_error_only" = "yes" ] && \
	error "Can not locate the VEA utilities. Please fix this problem and
	 then reattempt this configuration removal.
 
         Aborting VRTSfspro configuration installation attempt."
	exit 3
    fi

    #### Note that we will NOT handle search extension or its provider
    #### in fspro patch. It will be handled in its own patch

    #
    # update VERITAS Object Bus registry file
    #
    [ "$verbose" = "yes" ] && \
		note "Patching VRTSfspro patch in VEA Registry ... \c"

    cp $REGFILE $REGFILE.pre-fspro

    ######################
    # Bump up versions of the client extension entries
    ######################
    #
    #### VxFsCE.jar
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsCE Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpup_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsCE Version REG_SZ $bumped_up_ver

    #### FS Resource Bundles
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsRS_VxFsResourceBundle_en Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpup_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsRS_VxFsResourceBundle_en Version REG_SZ $bumped_up_ver
 
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsVmRS_VxFsResourceBundle_en Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpup_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsVmRS_VxFsResourceBundle_en Version REG_SZ $bumped_up_ver
 
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsVmLibRS_VxFsResourceBundle_en Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpup_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsVmLibRS_VxFsResourceBundle_en Version REG_SZ $bumped_up_ver
 
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsOneguiRS_VxFsOneguiResourceBundle_en Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpup_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsOneguiRS_VxFsOneguiResourceBundle_en Version REG_SZ $bumped_up_ver
 
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsHelp_en Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpup_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsHelp_en Version REG_SZ $bumped_up_ver
 
    ######################
    # Bump up versions of the search extension entries
    ######################
    #
    #### VxSearchCE.jar
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxSearchCE Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpup_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxSearchCE Version REG_SZ $bumped_up_ver

    #### Search Resource Bundles
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxSearchCERS Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpup_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxSearchCERS Version REG_SZ $bumped_up_ver

    ######################
    # Bump up versions of the message catalogs
    ######################
    ver=`$REGOPS $REGFILE queryvalue $FSMSGKEY Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpup_version $ver`
    $REGOPS $REGFILE setvalue $FSMSGKEY Version REG_SZ $bumped_up_ver

    ver=`$REGOPS $REGFILE queryvalue $VXMSGKEY Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpup_version $ver`
    $REGOPS $REGFILE setvalue $VXMSGKEY Version REG_SZ $bumped_up_ver

    ######################
    # Confine dependency only to vxvmprovider
    ######################
    $REGOPS $REGFILE setvalue $FSKEY DependsOn REG_SZ "vxvmprovider"
    $REGOPS $REGFILE setvalue $VXKEY DependsOn REG_SZ "vxvmprovider"

    [ "$verbose" = "yes" ] && echo " done"
 
    rm -rf $REGFILE.pre-fspro 2>/dev/null

    [ "$verbose" = "yes" ] && [ "$restart_vxsvc" = "yes" ] && echo
    [ "$verbose" = "yes" ] && [ "$restart_vxsvc" = "yes" ] && \
	note "To use the VRTSfspro you must restart the VEA server.
         Refer to the man page for vxsvc(1M)."

    [ "$verbose" = "yes" ] && echo
    [ "$verbose" = "yes" ] && \
		note "VRTSfspro patch installation complete.\n"
}

##############################################################################
# function to patchrm the fs provider to VEA                                 #
##############################################################################
fspro_patchrm()
{
    if [ ! -x $REGOPS -o ! -x $OBJTYPOPS -o ! -f $REGFILE ] 
    then
	[ "$verbose" = "yes" -o "$prt_error_only" = "yes" ] && \
	error "Can not locate the VEA utilities. Please fix this problem and
	 then reattempt this configuration removal.
 
         Aborting VRTSfspro configuration installation attempt."
	exit 3
    fi

    #### Note that we will NOT handle search extension or its provider
    #### in fspro patch. It will be handled in its own patch

    #
    # update VERITAS Object Bus registry file
    #
    [ "$verbose" = "yes" ] && \
		note "Unpatching VRTSfspro patch in VEA Registry ... \c"

    cp $REGFILE $REGFILE.pre-fspro

    ######################
    # Bump down versions of the client extension entries
    ######################
    #
    #### VxFsCE.jar
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsCE Version 2>/dev/null | awk '{print $5}'`
    bumped_down_ver=`bumpdown_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsCE Version REG_SZ $bumped_down_ver

    #### FS Resource Bundles
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsRS_VxFsResourceBundle_en Version 2>/dev/null | awk '{print $5}'`
    bumped_down_ver=`bumpdown_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsRS_VxFsResourceBundle_en Version REG_SZ $bumped_down_ver
 
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsVmRS_VxFsResourceBundle_en Version 2>/dev/null | awk '{print $5}'`
    bumped_down_ver=`bumpdown_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsVmRS_VxFsResourceBundle_en Version REG_SZ $bumped_down_ver
 
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsVmLibRS_VxFsResourceBundle_en Version 2>/dev/null | awk '{print $5}'`
    bumped_down_ver=`bumpdown_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsVmLibRS_VxFsResourceBundle_en Version REG_SZ $bumped_down_ver
 
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsOneguiRS_VxFsOneguiResourceBundle_en Version 2>/dev/null | awk '{print $5}'`
    bumped_down_ver=`bumpdown_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsOneguiRS_VxFsOneguiResourceBundle_en Version REG_SZ $bumped_down_ver
 
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxFsHelp_en Version 2>/dev/null | awk '{print $5}'`
    bumped_down_ver=`bumpdown_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxFsHelp_en Version REG_SZ $bumped_down_ver
 
    ######################
    # Bump down versions of the search extension entries
    ######################
    #
    #### VxSearchCE.jar
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxSearchCE Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpdown_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxSearchCE Version REG_SZ $bumped_up_ver

    #### Search Resource Bundles
    ver=`$REGOPS $REGFILE queryvalue $GUIKEY_VxSearchCERS Version 2>/dev/null | awk '{print $5}'`
    bumped_up_ver=`bumpdown_version $ver`
    $REGOPS $REGFILE setvalue $GUIKEY_VxSearchCERS Version REG_SZ $bumped_up_ver

    ######################
    # Bump down versions of the message catalogs
    ######################
    ver=`$REGOPS $REGFILE queryvalue $FSMSGKEY Version 2>/dev/null | awk '{print $5}'`
    bumped_down_ver=`bumpdown_version $ver`
    $REGOPS $REGFILE setvalue $FSMSGKEY Version REG_SZ $bumped_down_ver

    ver=`$REGOPS $REGFILE queryvalue $VXMSGKEY Version 2>/dev/null | awk '{print $5}'`
    bumped_down_ver=`bumpdown_version $ver`
    $REGOPS $REGFILE setvalue $VXMSGKEY Version REG_SZ $bumped_down_ver

    [ "$verbose" = "yes" ] && echo " done"
 
    rm -rf $REGFILE.pre-fspro 2>/dev/null

    [ "$verbose" = "yes" ] && [ "$restart_vxsvc" = "yes" ] && echo
    [ "$verbose" = "yes" ] && [ "$restart_vxsvc" = "yes" ] && \
	note "To use the VRTSfspro you must restart the VEA server.
         Refer to the man page for vxsvc(1M)."

    [ "$verbose" = "yes" ] && echo
    [ "$verbose" = "yes" ] && \
		note "VRTSfspro patch uninstallation complete.\n"
}

set_vars()
{
	case $OS_PLAT in
	SunOS | Solaris)
		_ECHO="echo";
		restart_vxsvc=yes;
		;;
	AIX | aix)
		_ECHO="echo";
		restart_vxsvc=yes;
		;;
	HP-UX | hpux)
		_ECHO="echo";
		restart_vxsvc=no;
		;;
	Linux | linux)
		_ECHO="echo -e";
		restart_vxsvc=yes;
		;;
	esac
}

###########################################################################
###  main()
###########################################################################
force=no
verbose=no
debug=no
prt_usage=yes
prt_error_only=yes
_ECHO="echo"

set_vars

if [ $# -lt 1 ]
then
	usage
	exit 1
fi

while getopts :fFvVdDpPqQeE c
do
        case $c in
        f|F)    force=yes	
		;;
        v|V)    verbose=yes
		;;
        d|D)    debug=yes
		;;
        p|P)    prt_usage=no; verbose=yes; prt_error_only=yes 
		;;
        q|E)    prt_usage=no; verbose=no; prt_error_only=no 
		;;
        e|E)    prt_usage=no; verbose=no; prt_error_only=yes 
		;;
        ?)      usage; exit 1           
		;;
        esac
done

shift `expr $OPTIND - 1`
if [ $# -ne 1 ]
then
	usage  
	exit 1
fi

option=$1
if [ -z "$option" ]
then
	usage
	exit 1
fi

case $option in
	add)		action=add	;;
	remove)		action=remove	;;
	patchadd) 	action=patchadd	;;
	patchrm) 	action=patchrm	;;
	*)      	usage; exit 1	;;
esac

###################################
#
# add VRTSfspro config
#
###################################
if [ "$option" = "add" ]
then
    set_vars
    if [ "$force" = "no" ]
    then
    	case $OS_PLAT in
    	SunOS | Solaris)
	    SHLIB_EXT=so
	    ### test for "if pkginfo -q VRTSob" or "if pkginfo -q VRTSobdev"
	    OBPKG=0
	    $PKGINFO -q VRTSob > /dev/null 2>&1
	    if [ $? = 0 ]
	    then
		OBPKG=1
	    fi

	    OBDEVPKG=0
	    $PKGINFO -q VRTSobdev > /dev/null 2>&1
	    if [ $? = 0 ]
	    then
		OBDEVPKG=1
	    fi

	    if [ \( \( "$OBPKG" -eq 1 \) -o \( "$OBDEVPKG" -eq 1 \) \) -a \( -f $VXSVC \) ]
	    then
		[ "$verbose" = "yes" ] && echo
	    else
		[ "$verbose" = "yes" ] && error "This installation attempt detected that the
         VEA server package (VRTSob) is not installed on this host.

         You must first install the VEA server package (VRTSob) before
	 installing this VRTSfspro package.

         This installation attempt of the VRTSfspro package will
         now be aborted."
		fatalexit
	    fi
	    ##############
	    # VRTSob or VRTSobdev is installed, so continue with the VRTSfspro
	    # package installation
	    ##############

	    ;;		

 	AIX | aix)
	    ##############
	    # Aix has a way to specify 'either or' type of prereq. So we
	    # use that in lpp_name during pkg building and do not need to
	    # do dependency checks here.
	    ##############
	    
	    SHLIB_EXT=so
 	    ;;		

	HP-UX | hpux)
	    SHLIB_EXT=sl
	    ;;		
	Linux | linux)
	    SHLIB_EXT=so
	    #
	    # Perform checkinstall processing for the VERITAS Enterprise
	    # Administrator Service package (VRTSob), and VERITAS
	    # File System pkg (VRTSvxfs)
	    #
	    
	    # basedir of the VRTSob package
	    #

	    if [ -f $VXSVC ]
	    then
		[ "$verbose" = "yes" ] && echo
	    else
		[ "$verbose" = "yes" ] && error "This installation attempt detected that the
         VEA server package (VRTSob) is not installed on this host.
 
         You must first install the VEA server package (VRTSob) before
  	 installing this VRTSfspro package.

         This installation attempt of the VRTSfspro package will
         now be aborted."
		fatalexit
	    fi

	    ##############
	    # VRTSob is installed, so continue with VRTSfspro pkg install
	    ##############

	    ;;		

	esac	
    fi	# force = no

    if [ ! -f $FSPROBASE/lib/osfs_provider.$SHLIB_EXT ]
    then
	[ "$verbose" = "yes" ] && error "VRTSfspro installation terminated; This VRTSfspro package
         does not contain a VRTSfspro library for this version of VxFS."
	fatalexit
    fi

    if [ ! -f $FSPROBASE/lib/vxfs_provider.$SHLIB_EXT ]
    then
	[ "$verbose" = "yes" ] && error "VRTSfspro installation terminated; This VRTSfspro package
         does not contain a VRTSfspro library for this version of VxFS."
	fatalexit
    fi

    #############################################
    # register the fs provider to VIP 
    #############################################
    fspro_register

fi   # add	


###################################
#
# remove VRTSfspro config
#
###################################
if [ "$option" = "remove" ]
then
    set_vars

    # Perform preremove processing for the VRTSfspro package.

    #############################################
    # un-register the fs provider to VIP 
    #############################################
    fspro_unregister
 
fi   # remove

###################################
#
# patchadd VRTSfspro config
#
###################################
if [ "$option" = "patchadd" ]
then
    set_vars
    case $OS_PLAT in
    SunOS | Solaris)
	SHLIB_EXT=so
	;;		

    AIX | aix)
	SHLIB_EXT=so
	;;		

    HP-UX | hpux)
	SHLIB_EXT=sl
	;;		

    Linux | linux)
	SHLIB_EXT=so
	;;		
esac

    #############################################
    # patchadd the Registry for the fs provider in VEA
    #############################################
    fspro_patchadd
 
fi   # patchadd

###################################
#
# patchrm VRTSfspro config
#
###################################
if [ "$option" = "patchrm" ]
then
    set_vars

    ###########################################################
    # patchrm the Registry for the fs provider from VEA
    ###########################################################
    fspro_patchrm
 
fi   # patchrm

exit 0
