#! /sbin/sh

########
#  Product: PHKL_18543
#  Fileset: PHKL_18543
#  configure
# @(#) configure $Date: 1999/05/28 13:58:10 $Revision: r11ros/cup_ros_ep3_pb/4 PATCH_11.00 (PHKL_18543)
########
#
# (c) Copyright Hewlett-Packard Company, 1998,1999
#
########

_PATCHID=PHKL_18543

    UTILS="/usr/lbin/sw/control_utils"
    if [[ ! -f $UTILS ]]
    then
        echo "ERROR: Cannot find $UTILS"
        exit 1
    fi
    . $UTILS
    exitval=$SUCCESS

#########################################################################
# This script part is to replace the whole custom part of the script with
# another patch if needed.  At initial patch release time there is no 
# basepatch_utils file
#

BASEPATCH_UTILS="$SW_ROOT_DIRECTORY/usr/lbin/patch/basepatch_utils"

if [ -f $BASEPATCH_UTILS ] 
then
    # replace with a fixed version if needed
    print -u2 "NOTE:    $BASEPATCH_UTILS installed."
    print -u2 "         Using control script functions from this file."
    . $BASEPATCH_UTILS
    configure_cntl || exitval=$? # retain a non-zero return value
    exit $exitval
fi # [ -f $BASEPATCH_UTILS ]

########################################################
#                                                      #
# 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
        if [[ -x /sbin/ioscan ]] && ( /sbin/ioscan -f | grep -q 'PCI')
        then
             mod_systemfile $SW_SYSTEM_FILE_PATH -a diag1
             if [[ $? -ne 0 ]]; then
                print  "ERROR: Cannot update $SW_SYSTEM_FILE_PATH to"
                print  "   include diag1 ($FILESET functionality)."
                exitval=$FAILURE
             fi
        fi    # if ioscan
    fi     # end of $SW_DEFERRED_KERNBLD

################################################################################
# make diagnostic device file

    if [ ! -e /dev/diag/diag1 ] ; then
        mknod /dev/diag/diag1 c 183 0x80
        if [[ $? -ne 0 ]]; then
            print  "ERROR:   Cannot update required functionality ($FILESET).  Create device"
            print  "         file \"mknod /dev/diag/diag1 c 183 0x80\", so PCI Diagnostics work."
            exitval=$FAILURE
        fi
    fi # [ ! -e /dev/diag/diag1 ]

###########################################################################
#
# Change the IPD data on the master file in the patch and original fileset
# It may have been changed in the postinstall.  If not, this does no harm
#
    master=$SW_ROOT_DIRECTORY/usr/conf/master.d/vxfs
    if [ -f $master ]
    then
        swmodify -x files=$master $_PATCHID.VXFS-BASE-KRN
        swmodify -x files=$master JournalFS.VXFS-BASE-KRN
    fi # [ -f $master ]

exit $exitval
