#!/sbin/sh
#------------------------------------------------------------------#
#
# HPUX_ID: @(#) $Revision: 19.5 $ generated on Thu Dec  6 17:43:22 EST 2001
# Product: OS-Core
# Fileset: CORE2-KRN
# Postremove script for func0 driver patch
#
# (c)Copyright 1983-2001 Hewlett-Packard Co.,  All Rights Reserved.
#
#------------------------------------------------------------------#
# SD postremove 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 cleanup actions after the     #
# patch's files have been removed.                                 #
#------------------------------------------------------------------#

_PATCHID=PHNE_25603

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

########
# FUNCTIONS
########
# DelDriverEntry
#
#   Purpose:  To Del to the system file a driver that this fileset has
#       delivered. Set the $exitval value based on the return value from
#       mod_systemfile().  If multiple deletions, ensure that a FAILURE
#       value of $exitval is not reduced by a later SUCCESS return.
#
DelDriverEntry()
{
     driver=$1
     mod_systemfile $SW_SYSTEM_FILE_PATH -d $driver
     if [[ $? -ne 0 ]]
       then
          print  "ERROR:   Cannot update $SW_SYSTEM_FILE_PATH to"
          print  "         include the $driver driver."
          exitval=$FAILURE
     fi
} #END DelDriverEntry


# If there is a func0 device or an entry in /stand/system file, then
# remove the entry from system file
if [[ -x /sbin/ioscan ]] && \
   ((/sbin/ioscan -kf | grep -q -e func0) || \
    ( grep -q -e func0 /stand/system ));
then

    DelDriverEntry func0

fi   # if ioscan

exit $exitval
