#! /bin/sh
#
#
# Copyright (c) 1996-1999 by Sun Microsystems, Inc.
# All rights reserved.
#
#pragma ident	"@(#)postinstall	1.9	03/03/10 SMI"
#
###########################################################################
#
# postinstall for SUNWscssv
#
#	* Add entries to help configuration file
#
###########################################################################

PATH=/usr/bin:/usr/sbin:${BASEDIR}/SUNWsymon/sbin
export PATH

PKGNAME=SUNWscssv
PROG=${PKGNAME}.postinstall

###########################################
#
# is_symon_help_exist
#
#	Check if symon-help-j.x file exist
#
###########################################
is_symon_help_exist()
{
	help_file=${BASEDIR}/SUNWsymon/classes/base/console/cfg/symon-help-j.x

	if [ ! -f $help_file ]
	then
		echo "$help_file: file not exist"
		return 1
	fi
}

###########################################
#
# remove_help_entries
#
#	Remove entries from help configuration file
#
###########################################
remove_help_entries()
{
	mkdir -p /tmp/${BASEDIR}/SUNWsymon/sbin
	if [ $? != 0 ]; then return 1; fi

	es-chelp -d sc-gen-help
	es-chelp -d sc-gen-stat-help
	es-chelp -d sc-gen-prop-help
	es-chelp -d sc-nodes-help
	es-chelp -d sc-nodes-stat-help
	es-chelp -d sc-nodes-prop-help
	es-chelp -d sc-devGrp-help
	es-chelp -d sc-devGrp-stat-help
	es-chelp -d sc-devGrp-prop-help
	es-chelp -d sc-quorum-help
	es-chelp -d sc-quorum-stat-help
	es-chelp -d sc-quorum-prop-help
	es-chelp -d sc-transp-help
	es-chelp -d sc-transp-stat-help
	es-chelp -d sc-transp-prop-help
	es-chelp -d sc-rt-help
	es-chelp -d sc-rt-prop-help
	es-chelp -d sc-rt-method-help
	es-chelp -d sc-rt-param-help
	es-chelp -d sc-rt-resources-help
	es-chelp -d sc-rg-help
	es-chelp -d sc-rg-prop-help
	es-chelp -d sc-rg-stat-help
	es-chelp -d sc-fo-help
	es-chelp -d sc-fo-stat-help
	es-chelp -d sc-fo-prop-help
	es-chelp -d sc-fo-resources-help
	es-chelp -d sc-fo-method-help
	es-chelp -d sc-ss-help
	es-chelp -d sc-ss-stat-help
	es-chelp -d sc-ss-prop-help
	es-chelp -d sc-ss-resources-help
	es-chelp -d sc-ss-method-help

}

###########################################
#
# Add entries to help configuration file
#
###########################################
add_help_entries()
{
	mkdir -p /tmp/${BASEDIR}/SUNWsymon/sbin
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-gen-help main.top.html
	if [ $? != 0 ]; then return 1; fi
	
	es-chelp -a sc-gen-stat-help status.howtoguts.html#ClustStat
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-gen-prop-help config.howtoguts.html#ClustConfig
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-nodes-help phost.howtoguts.html
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-nodes-stat-help status.howtoguts.html#NodeStat
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-nodes-prop-help config.howtoguts.html#NodeConfig
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-devGrp-help device.howtoguts.html
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-devGrp-stat-help status.howtoguts.html#DevStat
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-devGrp-prop-help config.howtoguts.html#DevConfig
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-quorum-help quorum.howtoguts.html
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-quorum-stat-help status.howtoguts.html#QStat
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-quorum-prop-help config.howtoguts.html#QConfig
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-transp-help trans.howtoguts.html
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-transp-stat-help status.howtoguts.html#TransStat
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-transp-prop-help config.howtoguts.html#TransConfig
	if [ $? != 0 ]; then return 1; fi


	es-chelp -a sc-rt-help restype.howtoguts.html
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-rt-prop-help config.howtoguts.html#RTConfig
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-rt-method-help config.howtoguts.html#RTConfig
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-rt-param-help config.howtoguts.html#RTConfig
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-rt-resources-help config.howtoguts.html#ResConfig
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-rg-help resgrmon.howtoguts.html
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-rg-prop-help resgrmon.howtoguts.html
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-rg-stat-help resgrmon.howtoguts.html
	if [ $? != 0 ]; then return 1; fi


	es-chelp -a sc-fo-help resgrmon.howtoguts.html
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-ss-help resgrmon.howtoguts.html
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-fo-stat-help status.howtoguts.html#FORGStat
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-fo-prop-help config.howtoguts.html#FORGConfig
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-fo-resources-help config.howtoguts.html#FORGConfig
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-fo-method-help config.howtoguts.html#FORGConfig
	if [ $? != 0 ]; then return 1; fi

	es-chelp -a sc-ss-stat-help status.howtoguts.html#SSRGStat
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-ss-prop-help config.howtoguts.html#SSRGConfig
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-ss-resources-help config.howtoguts.html#SSRGConfig
	if [ $? != 0 ]; then return 1; fi
	es-chelp -a sc-ss-method-help config.howtoguts.html#SSRGConfig
	if [ $? != 0 ]; then return 1; fi

}

###########################################
#
# main
#
###########################################
# catch common signals
trap 'echo "${PROG}: caught signal"; exit 1' 1 2 3 15

is_symon_help_exist
if [ $? != 0 ]; then exit 0; fi

remove_help_entries
add_help_entries

if [ $? != 0 ]
then
	remove_help_entries
	exit 1
fi
