#!/bin/sh
#
# postremove script for pkgrm ICNC Solstice suites
# This script is aimed to remove from the common index
# all the books contained in this package.
#

echo
echo "Removing entry from the Solstice documentation index..."

# safety first, in case this does something nasty
#
sync
if [ -z "$BASEDIR" ]
then
	BASEDIR=/opt
fi
PATH=$PATH:/usr/bin
DOCROOT=$BASEDIR/SUNWconn/docs

# This function is aimed to unpatch the index.htm
#	$1	book to remove
#
unpatch_index_htm ()
{
	book=$1
	res=`grep "$book" $DOCROOT/index.htm`
	if [ -z "$res" ]
	then
		echo "Book $book isn't installed"
	else
		grep -v "$book" $DOCROOT/index.htm > /tmp/index.htm.$$
		mv /tmp/index.htm.$$ $DOCROOT/index.htm
		echo "Book $book removed"
	fi
}


# Install the docs...
#
cp -p $DOCROOT/index.htm $DOCROOT/index.htm.bak

unpatch_index_htm "Java Dynamic Management Kit 3.0 Overview and Examples"
unpatch_index_htm "Java Dynamic Management Kit 3.0 Programming Guide"
unpatch_index_htm "Java Dynamic Management Kit 3.0 API Reference"

noentry=`grep images/bullet.gif $DOCROOT/index.htm`
if [ -z "$noentry" ]
then
	rm -f $DOCROOT/index.htm
fi

exit 0

# End of file
