#! /bin/sh
#
# ident	"@(#)postremove	1.3	03/07/09 SMI"
#
# Copyright (c) 2002-2004 by Sun Microsystems, Inc.
# All rights reserved.
#

OS=`uname -s`
if [ ! -n "${OS}" ]; then
    echo "Unable to determine operating system."
    exit 1
fi

if [ "${OS}" != "SunOS" -a "${OS}" != "Linux" -a "${OS}" != "HP-UX" -a "${OS}" != "AIX" ]; then
    echo "Not supported on detected OS \"${OS}\"."
    exit 1
fi

# Could be uninstalling from a zone that shares a read-only /usr.
# If so, then exit.
tiptoe=$BASEDIR/usr/_.$$
touch $tiptoe >/dev/null 2>&1
if [ $? -ne 0 ]; then
    exit 0
fi
rm -f $tiptoe

/bin/rm -rf ${BASEDIR}/usr/share/webconsole/lib/.consolelogin

if [ "${OS}" = "Linux" -a "${OS}" = "HP-UX" -a "${OS}" = "AIX" ]; then

    RTRC=/usr/lib/webconsole/.runtimerc
    if [ -f "${RTRC}" ]; then

	# Get Tomcat location and delete copy of SSI jar
	. $RTRC
	if [ -n "${CATALINA_HOME}" ]; then
	    /bin/rm ${CATALINA_HOME}/server/lib/servlets-ssi.jar
	fi

	/bin/rm -f $RTRC
    fi
fi

exit 0
