#!/usr/bin/ksh

ESM_BASE=`/bin/pkgparam SUNWstm ESM_BASE 2> /dev/null`
if [ $? -ne 0 ]; then
    echo "ERROR: Unable to execute $0. SUNWstm is not found."
    exit 1
fi

ESM_LIB=$ESM_BASE/lib
# source the libs
. $ESM_LIB/esm_globals.ksh
. $ESM_LIB/esm_lib.ksh

# Place log file in user's home directory if they are 
# not the root user.

user=`/bin/id | /bin/grep root | wc -l`
if [ $user -eq 0 ]; then
    ESM_LOG=/$HOME/.esm_cli.log
fi

# Trim logfile if it is too big
el_trim_log "$ESM_LOG" $EL_LOG_MAXSIZE


# Set Java Home
el_set_java_home
JAVA=$JAVA_HOME/bin/java

CLIJAR=$ESM_BASE/sssm/lib/clif_client.jar
CLASSPATH=.:$CLIJAR
export CLASSPATH

cd $ESM_BASE/bin

$JAVA com.sun.netstorage.mgmt.ui.cli.impl.client.CLIMainImpl ~app esm "$@"

exit $?
