#!/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 checkremove script template for 11.X patches.                 #
#------------------------------------------------------------------#
# This file is optional for all 11.X patches.  The purpose of this #
# script is to ensure that there is no patch specific restriction  #
# to removing the selected software from the target system.        #
#------------------------------------------------------------------#

_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

# The Built-in PCI 100BASE-T product was released through this patch. Removal
# of this patch will remove the built-in PCI 100BASE-T driver and will break
# the networking capability of the workstations where
# the Built-in PCI 100BASE-T is the only networking card.

BTLAN3=1
ioscan -kF |grep "10110019" | grep ":btlan3:" 2>&1 > /dev/null
BTLAN3=$?


# if this SAVEFILE exists and if its size is non-zero, then, there was some
# previous path

SAVEFILE="/var/adm/sw/save/PHNE_22244/LAN2-KRN/usr/conf/lib/libbtlan3.a"

# Allow patch removal only if the btlan3 card is not present or if there was
# a previous patch installed on this machine

if [ $BTLAN3 -ne 0 ] || [ -s $SAVEFILE ]
then
    exit $exitval
fi

echo "ERROR:   You have selected PHNE_22244 for removal.  This"
echo "         patch cannot be removed because it contains the driver"
echo "         for Built-in PCI 100BASE-T card."
echo "         Without this patch the machine will loose its networking"
echo "         capability. If you still want to remove PHNE_22244, use"
echo "         \"swremove.enforce_scripts=false\" in the default file or"
echo "         use the command line option \"-x enforce_scripts=false\""
echo "         with swremove(1M)"

exit $FAILURE
