#! /sbin/sh
##############
# Product: LVM
# Fileset: LVM-KRN
# configure
# @(#) $Revision: 1.4.98.1 $
##############
#
# (c) Copyright Hewlett-Packard Company, 1994
#
#####################

# 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                # Anticipate success

########################################################
#						       #
# If configuring a diskless client, or a disk that had #
# been mounted as an alternate root during swinstall,  #
# perform all necessary  kernel modifications.	       #
#						       #
########################################################

if [[ -n "${SW_DEFERRED_KERNBLD}" ]]
then
    

    ##########################################
    #                                        #
    # Place any drivers into /stand/system   #
    #                                        #
    ##########################################
    
    mod_systemfile $SW_SYSTEM_FILE_PATH -a lvm
    if [[ $? -ne 0 ]]
    then
        print "ERROR:   Cannot update $SW_SYSTEM_FILE_PATH to"
        print "         include lvm ($FILESET functionality)."
        exitval=$FAILURE 
    fi
    
    mod_systemfile $SW_SYSTEM_FILE_PATH -a lv	
    if [[ $? -ne 0 ]]
    then
        print "ERROR:   Cannot update $SW_SYSTEM_FILE_PATH to"
        print "         include lv ($FILESET functionality)."
        exitval=$FAILURE 
    fi
    
fi	# end of if [[ -n "${SW_DEFERRED_KERNBLD}" ]]

#
# Export the master file to the LVM-RUN fileset.
#
file="${SW_LOCATION}usr/conf/master.d/lvm"

	# If not already exported
if swlist -l file $PRODUCT.$FILESET 2>/dev/null | grep -q $file
then
    export_master $file
    if [[ $? -ne 0 ]]
    then
      echo "WARNING: Cannot give the master file(s) \"$file\""
      echo "         to ${FILESET%%-KRN}-RUN.  If you delete the ${FILESET}"
      echo "         fileset, SAM will not work correctly"
      if [[ $exitval -ne $FAILURE ]]
      then
	exitval=$WARNING
      fi
    fi
fi


#
# Fin.
#

exit $exitval
