#!/sbin/sh
#------------------------------------------------------------------#
#
# HPUX_ID: @(#) $Revision: 15.2 $ generated on Mon Aug 21 22:16:21 EDT 2000
#
# (c)Copyright 1983-2000 Hewlett-Packard Co.,  All Rights Reserved.
#
#------------------------------------------------------------------#
# SD configure script template for use with all patches.           #
#------------------------------------------------------------------#
# This file is optional for all patches.  The purpose of this      #
# script is to perform patch installation actions that cannot be   #
# accomplished by simple unconditional file extraction from the    #
# software source media.                                           #
#------------------------------------------------------------------#

_PATCHID=PHNE_22244

UTILS="/usr/lbin/sw/control_utils"

if [ ! -f $UTILS ]; then
    echo "ERROR:   Cannot find $UTILS"
    exit 1
fi

. $UTILS
exitval=$SUCCESS


##############################
#                            #
# Install Files in newconfig #
#                            #
##############################

for file in \
    /etc/rc.config.d/hpbase100conf
    # Place your files here. Do not use the
    # prefix "${SW_ROOT_DIRECTORY}" or "${SW_LOCATION}"
    # (newconfig_cp handles this).
    #
    # "" if none
do
    [ -z "$file" ] && continue
    newconfig_cp $file
    resultcode=$?
    if [[ $resultcode -eq 100 ]] # Working file not updated because file that
    then                         # used to be in newconfig has been removed.
        print "WARNING: Unable to determine if the file ${SW_LOCATION}$file"
        print "         has been modified.  Please merge any changes"
        print "         you have made with ${SW_ROOT_DIRECTORY}usr/newconfig/$file"
        print "         and put the result in ${SW_LOCATION}$file"

        exitval=$WARNING

    elif [[ $resultcode -eq 102 ]] # Working file not updated because new file
    then                           # == file that used to be in newconfig, but
                                   # the working file has been changed.
        print "WARNING: It appears that the file ${SW_LOCATION}$file has not"
        print "         changed since the system was last updated, but"
        print "         you may wish to examine the contents of the file"
        print "         ${SW_ROOT_DIRECTORY}usr/newconfig${file}."

        exitval=$WARNING

    elif [[ $resultcode -eq 103 ]] # The working file is different from both the
    then                           # last installed version and the new version

        print "WARNING: The file ${SW_LOCATION}$file has changed for this release."
        print "         Please merge in your localizations with the new"
        print "         version of the file in "
        print "         ${SW_ROOT_DIRECTORY}usr/newconfig${file}"
        print "         and put the result in ${SW_LOCATION}$file."

        exitval=$WARNING

    elif [[ $resultcode -ne 0 && $resultcode -ne 101 ]] # newconfig_cp didn't
    then                                                # exit with normal status

        print "ERROR:   Failed to update the file ${SW_LOCATION}$file."
        exitval=$FAILURE

    fi
done

# /etc/rc.config.d/hpbase100conf should not be removed with the
# patch's swremove command.  Otherwise, user configuration
# would be lost. 
#
# /usr/old/usr/newconfig/etc/rc.config.d/hpbase100conf was created
# and added to IPD file by 'newconfig_prep' in 'preinstall'.
#
# Remove these to file entries from the IPD

IPD_delfile /etc/rc.config.d/hpbase100conf
IPD_delfile /usr/old/usr/newconfig/etc/rc.config.d/hpbase100conf

###################################################################
# Do selective deletes from IPD
###################################################################

swlist -l file -l product Networking.LAN-RUN 2>/dev/null | grep -q "^[ ]*/etc/rc.config.d/hpbase100conf" 2>&1 >/dev/null
if [ $? -eq 0 ]
then
    IPD_delfile /etc/rc.config.d/hpbase100conf Networking.LAN-RUN 
fi


#
# PHNE_17071 did not delete this file, so, do it as a special case
# 
# Leave this part untouched for future patches.
#
if [[ `get_install_state PHNE_17071.LAN-RUN` = 'configured' ]]
then
    swlist -l file -l product PHNE_17071.LAN-RUN 2>/dev/null | grep -q "^[ ]*/etc/rc.config.d/hpbase100conf" 2>&1 >/dev/null
    if [ $? -eq 0 ]
    then
        IPD_delfile /etc/rc.config.d/hpbase100conf PHNE_17071.LAN-RUN
    fi

    swlist -l file -l product PHNE_17071.LAN-RUN 2>/dev/null | grep -q "[ ]*/usr/old/usr/newconfig/etc/rc.config.d/hpbase100conf" 2>&1 >/dev/null
    if [ $? -eq 0 ]
    then
        IPD_delfile /usr/old/usr/newconfig/etc/rc.config.d/hpbase100conf PHNE_17071.LAN-RUN
    fi
fi


#
# PHNE_18574 and PHNE_19020 did not delete this file, so, do it as a special
# case.
# Leave this part untouched for future patches.
#
for patch in PHNE_18574 PHNE_19020
do
    swlist -l file -l product ${patch}.LAN-RUN 2>/dev/null | grep -q "[ ]*/usr/old/usr/newconfig/etc/rc.config.d/hpbase100conf" 2>&1 >/dev/null
    if [ $? -eq 0 ]
    then
        IPD_delfile /usr/old/usr/newconfig/etc/rc.config.d/hpbase100conf ${patch}.LAN-RUN
    fi
done

# Configure product for nettl

NETTLCONF="/usr/sbin/nettlconf"
if [ ! -f $NETTLCONF ] ; then
        echo "ERROR:   Cannot find \"$NETTLCONF\"."
        exit $FAILURE
fi

CORE100_NUM=173

$NETTLCONF -S -i $CORE100_NUM -name base100 -class 12 -kernel \
     -lib libfmtbtlan3.sl -msg fmtbtlan3 -fmtfn subsys_btlan3_format \
     -group "10/100 Mb/s LAN/9000 Networking"


exit $exitval
