#! /sbin/sh
########
# Product: NETWORKING
# Fileset: NET-KRN 
# configure
# @(#) $Revision: 1.2.98.1 $
########
#
# (c) Copyright Hewlett-Packard Company 1993
#
########################################################################

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

    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   #
    #                                        #
    ##########################################
    
    for driver in inet   \
                  uipc   \
                  nm \
                  ni \
		  tpiso \
                  inet_cots \
                  inet_clts
        # Place your drivers here.
        # For example:
        # fss \
        # lv
    do
        mod_systemfile ${SW_SYSTEM_FILE_PATH} -a "$driver"
        if [[ $? -ne $SUCCESS ]]
        then
            print "ERROR:   Cannot update ${SW_SYSTEM_FILE_PATH} to include"
            print "         $driver ($FILESET functionality)."
            exitval=$FAILURE 
        fi
    done
    
    ###################################################
    #                                                 #
    # Remove drivers from ${SW_SYSTEM_FILE_PATH}      #
    #                                                 #
    ###################################################
    
    for driver in netman   
        # Place your drivers here.
        # For example:
        # fss \
        # lv
    do
        mod_systemfile ${SW_SYSTEM_FILE_PATH} -d "$driver"
        if [[ $? -ne $SUCCESS ]]
        then
            print "ERROR:   Cannot update ${SW_SYSTEM_FILE_PATH} to remove"
            print "         $driver ($FILESET functionality)."
            exitval=$FAILURE 
        fi
    done
    
fi      # end of if [[ -n "${SW_DEFERRED_KERNBLD}" ]]

#
# Export the master file to the NET-RUN fileset.
#
file="${SW_LOCATION}usr/conf/master.d/net"
if swlist -l file $PRODUCT.$FILESET 2>/dev/null | grep -q $file
then        # master file not yet exported
  export_master $file
  if [[ $? -ne 0 ]]
    then
      echo "WARNING: Cannot give the master file(s) \"$file\""
      echo "         to ${FILESET%%-KRN}-RUN.  If you delete this"
      echo "         fileset, SAM will not be able to handle your"
      echo "         device files"
      if [[ $exitval -ne $FAILURE ]]
        then
          exitval=$WARNING
      fi # [[ $exitval -ne $FAILURE ]]
    fi # [[ $? -ne 0 ]]
fi # swlist -l file $PRODUCT.$FILESET


exit $exitval
