#! /sbin/sh
###############
# Product: ProcessSwitch
# Fileset: SWITCHOVER-KRN
# postinstall
# @(#) $Revision: 1.3.98.1 $
################
#
# (c) Copyright Hewlett-Packard Company, 1993
#
########################################################################
#                                                                      #
# General requirements:                                                #
#								       #
#  For servers/standalone:					       #
#   1) Add the driver "switch" to the system file.		       #
#								       #
#  For all systems:						       #
#   1) Make sure that the kernel libraries are in /usr, rather than    #
#      in /opt.							       #
#                                                                      #
########################################################################

# The global variables SUCCESS, FAILURE, WARNING, EXCLUDE, PATH, ROOT,
# SW_CTL_SCRIPT_NAME, _pf, PRODUCT, and FILESET are all set by control_utils.

UTILS=/usr/lbin/sw/control_utils
if [[ ! -f $UTILS ]]
then
    print "ERROR:   Cannot find the sh functions library $UTILS"
    exit 1
fi
. $UTILS

exitval=$SUCCESS

########################################################
# Only modify the system file on the root file system. #
# If this is an NFSdiskless installation, or alternate #
# root, then configure will handle it.                 #
########################################################

if [[ -z "${SW_DEFERRED_KERNBLD}" ]]
then
    
    ########################################
    #                                      #
    # Place any drivers into /stand/system #
    #                                      #
    ########################################
    
    for driver in \
	switch 
    do
        mod_systemfile $SW_SYSTEM_FILE_PATH -a "$driver"
        if [[ $? -ne 0 ]]
        then
            print "ERROR:   Cannot update $SW_SYSTEM_FILE_PATH to"
            print "         include $driver ($FILESET functionality)."
            exitval=$FAILURE 
        fi
    done
    
    ########################################
    #				           #
    # Modify any tunable kernel parameters #
    #				           #
    ########################################

    # NOT APPLICABLE TO THIS FILESET

fi	# end of if [[ -z "${SW_DEFERRED_KERNBLD}" ]]

#################################################
#						#
# Always make sure that libswitch.a is in	#
# ${SW_ROOT_DIRECTORY}usr/conf/lib. This step	#
# must be done on the server, so there is no	#
# test for client installation.			#
#						#
#################################################

if [[ "$SW_LOCATION" != "/" ]] # delivering to alternate product directory
then
    mv -f ${SW_ROOT_DIRECTORY}${SW_LOCATION}/usr/conf/lib/libswitch.a \
          ${SW_ROOT_DIRECTORY}/usr/conf/lib/libswitch.a
fi

    #############
    # Finished. #
    #############

exit $exitval
