#! /sbin/sh
###############
# Product: LVM
# Fileset: LVM-KRN
# postinstall
# @(#) $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

########################################################
# 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 drivers into system file.      #
    #                                      #
    ########################################
    
    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

    ########################################
    #
    # Add lv dump if configured by cold install
    #
    ########################################
    # Config doesn't care if there are multiple instances of 
    # "dump lvol", so don't bother checking.

    if [[ -n ${SW_INITIAL_INSTALL} ]]
    then
      if [[ -x /sbin/lvlnboot ]] && ( /sbin/lvlnboot -v | grep -q '^Dump:')
      then
	print "dump lvol" >> $SW_SYSTEM_FILE_PATH
      fi
    fi
    
    #############
    # Finished. #
    #############

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

exit $exitval
