#!/sbin/sh
###############
# Product: PHKL_25010
# Fileset: PHKL_25010
# postinstall
# @(#) postinstall  $Revision: AUTO-GENERATED PATCH_11.00 (PHKL_25010)
#------------------------------------------------------------------#
# (c)Copyright 1983-2001 Hewlett-Packard Co., All Rights Reserved. #
#------------------------------------------------------------------#
# SD postinstall script template for 11.X patches.                 #
#------------------------------------------------------------------#
# This file is optional for all 11.X patches.  The purpose of this #
# script is to prepare for a kernel build when required by the     #
# install conditions.  The script can also drive events that must  #
# occur before a system reboot occurs.                             #
#------------------------------------------------------------------#

_PATCHID=PHKL_25010

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
#%# <static: PHKL_20478>
#%#
device1="hcd"
device2="SerialBus"

########
# FUNCTIONS
########
# AddDriverEntry
#
#   Purpose:  To add 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 additions, ensure that a FAILURE 
#	value of $exitval is not reduced by a later SUCCESS return.
#
AddDriverEntry()
{
     driver=$1
     mod_systemfile $SW_SYSTEM_FILE_PATH -a $driver
     if [[ $? -ne 0 ]]
       then
          print  "ERROR: Cannot update $SW_SYSTEM_FILE_PATH to"
          print  "       include the $driver driver."
          exitval=$FAILURE
     fi
} #END AddDriverEntry

#########################################################################
#########################################################################
# This script part is intended to insert post 11.00 drivers that are needed
# by the kernel when new driver patches are installed and certain hardware 
# is present.
#
# This addition must be done at the patch level since it is fixing a 
# difficulty caused by the early truncate_sys call from the control scripts
# in the CORE-KRN fileset, but depends on matching the new drivers defined 
# in master.d/core-hpux which is delivered in KERN2-RUN.
#########################################################################

if [[ -x /sbin/ioscan ]] && \
   ( /sbin/ioscan -kf | grep -q -e $device1 -e $device2 ); then

  AddDriverEntry hcd
  AddDriverEntry usbd
  AddDriverEntry hub
  AddDriverEntry hid
fi   # if ioscan
#%#
#%# </static: PHKL_20478>


#%# DO NOT REMOVE ANYTHING AFTER THIS LINE
#%# <PATCH CONTROL SCRIPT LOG>
#%# PHKL_20478
#%# </PATCH CONTROL SCRIPT LOG>
 
##### END_OF_CUSTOMIZATION
exit $exitval