#!/sbin/sh
###############
# Product: PHKL_25014
# Fileset: PHKL_25014
# postinstall
# @(#) postinstall  $Revision: AUTO-GENERATED PATCH_11.00 (PHKL_25014)
#------------------------------------------------------------------#
# (c)Copyright 1983-2002 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_25014

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
add_to_sys()
{
	ret_code=$SUCCESS
	#
	# add the needed entries to the system file
	#

	mod_systemfile ${SW_SYSTEM_FILE_PATH} -a c8xx
	retval=$?
	if [ $retval -ne 0 ]; then
		ret_code=$WARNING
	fi

	return $ret_code
}

#
# Extract the PCI ID of the devices installed in the
# system to determine if c8xx is needed in the kernel.
#

card_installed=`ioscan -F | awk -F: '{ print $12 }' | \
				awk '{printf("%02x%02x%02x%02x\n",$1,$2,$3,$4)}' | \
				grep '10000021'`
if [ -z "$card_installed" ]; then
	# No card is installed; do not do anything.
	# System administrator must use SAM to add c8xx
	# if it is needed in the future.
	exit $SUCCESS
fi

add_to_sys
retval=$?
if [ $retval -eq $WARNING ] ; then
	exitval=$WARNING
fi
 
##### END_OF_CUSTOMIZATION
exit $exitval