#!/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 preremove script template for 11.X patches.                   #
#------------------------------------------------------------------#
# This file is optional for all 11.X patches.  The purpose of this #
# script is to perform any necessary actions not done in the       #
# unconfigure script in preparation for removal of the patch's     #
# files.                                                           #
#------------------------------------------------------------------#

_PATCHID=PHNE_22244

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

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

. $UTILS
exitval=$SUCCESS

#####
##### Insert any code you may require at this point in the script.
##### Pay attention to the exitval variable and set appropriately
##### in your code.  If you are unsure as to what types of operations
##### are legal in this file and what types aren't, consult the 
##### "Guidelines for SD Control Scripts" document.
#####
##### START_CUSTOMIZATION_HERE

#############################################################################
# Remove the /stand/system entry for btlan3 only if the saved btlan3 master #
# file is zero in size. This implies that no btlan3 patch was installed     #
# before this (being removed) patch                                         #
#############################################################################

if [ ! -s /var/adm/sw/save/PHNE_22244/LAN2-KRN/usr/conf/master.d/lan100bt-core ]
then

        ####### delete the drivers to the kernel
        RES0=0
        mod_systemfile $SW_SYSTEM_FILE_PATH -d btlan3
        RES0=$?

        ####### see if the mod_systemfiles worked
        if [ $RES0 -ne 0 ] ; then
            echo "WARNING: Cannot modify the kernel configuration file.  The"
            echo "         appropriate 100BT LAN driver must be manually removed"
            echo "         from the system file."
            exit $WARNING
        fi

        RES0=0
        mod_systemfile $SW_SYSTEM_FILE_PATH -d maclan
        RES0=$?

        ####### see if the mod_systemfiles worked
        if [ $RES0 -ne 0 ] ; then
            echo "WARNING: Cannot modify the kernel configuration file.  The"
            echo "         LLA/MAC pseudo driver must be manually removed"
            echo "         from the system file."
            exit $WARNING
        fi


        # unconfigure product for nettl

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

        CORE100_NUM=173
        $NETTLCONF -d $CORE100_NUM

fi

exit $exitval
