#!/sbin/sh
#############################################################################
#  Product: FCMassStorage
#  Fileset: FCMS-KRN
#  postinstall
#  @(#) $Revision: 1.1.98.3 $
#############################################################################
# (c) Copyright Hewlett-Packard Company, 1995
#############################################################################

####### add our entry to the kernel config file only if server or standalone
if [ -n "$SW_DEFERRED_KERNBLD" ] ; then
        # we are on a client, 
        exit $SUCCESS
fi



####### setup environment 
PATH=${SW_PATH}:${SW_ROOT_DIRECTORY}usr/lbin/sw
UTILS="/usr/lbin/sw/control_utils"
if [ ! -f $UTILS ] ; then
    echo "ERROR:   Cannot find \"$UTILS\"."
    exit $FAILURE
fi
. $UTILS


####### For now, do something only if this is a Series 800 machine

ARCHITECTURE=`get_arch`
if [ $ARCHITECTURE -ne "800" ]; then
    exit $SUCCESS
fi

####### add our entry to the kernel config file

#BABY_HUGO_TEST=$FAILURE
#
#for LINE in `ioscan -C fc -F | sed 's/ /~/g'` ; do
#    SVERS_MODEL=`echo "$LINE" | awk -F':' '{ print $12 }' | sed 's/~/ /g' | \
#	    awk '{printf("%02x%02x%02x\n",$5,$6,$7)}' | \
#            awk '{ $1=substr($1,2,5); print $1 }'`
#    case $SVERS_MODEL in
#        00091)
#            # 0x91 ---> GSC+ Fibre Channel adapter card
#	    BABY_HUGO_TEST=$SUCCESS
#            ;;
#        *)
#    esac
#done


EXITVAL=$SUCCESS    # anticipate success

####### if we didn't find any Baby Hugo cards, tell the user and let the 
####### install go on
#
#if [ $BABY_HUGO_TEST -ne $SUCCESS ] ; then
#    echo "WARNING: Cannot find a Baby Hugo Fibre Channel card installed"
#    echo "         in the system.  No FCMS drivers have been configured"
#    echo "         into the kernel."
#    exit $WARNING
#fi

####### add the drivers to the kernel

RES_FCP=0
RES_FCPMUX=0
mod_systemfile $SW_SYSTEM_FILE_PATH -a fcgsc_fcp
RES_FCP=$?
mod_systemfile $SW_SYSTEM_FILE_PATH -a fcpmux
RES_FCPMUX=$?


####### see if the mod_systemfiles worked
if [ $RES_FCP -ne $SUCCESS ] ; then
    echo "ERROR:   Cannot modify the kernel configuration file for the fcp"
    echo "         driver. It must be manually configured into the kernel."
    EXITVAL=$FAILURE
fi

if [ $RES_FCPMUX -ne $SUCCESS ] ; then
    echo "ERROR:   Cannot modify the kernel configuration file for the fcpmux"
    echo "         driver. It must be manually configured into the kernel."
    EXITVAL=$FAILURE
fi

exit $EXITVAL

