#!/bin/sh
#
# ident "@(#)preremove	1.7	07/11/03 SMI"
#
# Copyright 2003-2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

CONSOLE_DIR=${BASEDIR}/usr/share/webconsole

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

if [ "${OS}" = "SunOS" ]; then
    IMPL=solaris_impl
elif [ "${OS}" = "Linux" ]; then
    IMPL=linux_impl
elif [ "${OS}" = "HP-UX" ]; then
    IMPL=hpux_impl
elif [ "${OS}" = "AIX" ]; then
    IMPL=aix_impl
else
    echo "Not supported on detected OS \"${OS}\"."
    exit 1
fi

SMREG=${BASEDIR}/usr/sbin/smreg
if [ -s ${SMREG} ]; then
    ${SMREG} remove -l -s ALL com_sun_management_${IMPL}.jar
fi

# Unregister the loginmodules
if [ -s ${SMREG} ]; then
    ${SMREG} remove -m com.sun.management.services.authentication.PamLoginModule

    if [ "${OS}" = "SunOS" ]; then
	${SMREG} remove -m com.sun.management.services.authentication.RbacRoleLoginModule 
    fi

fi

exit 0
