#!/bin/sh -f
# BEGIN COPYRIGHT BLOCK
# Copyright (C) 2001 Sun Microsystems, Inc.  Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#

# END COPYRIGHT BLOCK

# To make sure commands like uname, dirname etc. are in PATH
PATH=/bin:/usr/bin:$PATH

# Make sure the command is executed from the server-root
PRG=`which $0`
SRVROOT=`dirname "$PRG"`/../..
cd $SRVROOT

JAVAEXE=./bin/base/jre/bin/java
THREADMODEL=-native
LD_LIBRARY_PATH=$SRVROOT/lib/jss:$SRVROOT/lib
SHLIB_PATH=$SRVROOT/lib/jss:$SRVROOT/lib
LIBPATH=$SRVROOT/lib/jss:$SRVROOT/lib
JAVAOPTIONS=-Djava.library.path=$LD_LIBRARY_PATH
CLASSPATH=./java/fedora-nmclf-1.0.jar:./java/ldapjdk.jar:./java/jss3.jar:./java/base.jar:./java/fedora-mcc-1.0.jar:./java/jars/fedora-admserv-1.0.jar
MAINCLASS=com.netscape.management.admserv.cmdln.CommandLine
PLATFORM=`uname`

# Set AIX, (1) run sh/java (2) thread model option is not supported
if [ "$PLATFORM" = "AIX" ]; then 
   JAVAEXE=./bin/base/jre/sh/java
   THREADMODEL=
fi 

if [ "$PLATFORM" = "OSF1" ]; then
    JAVAOPTIONS="-taso -Djava.library.path=$LD_LIBRARY_PATH"
fi

export LD_LIBRARY_PATH
export SHLIB_PATH
export LIBPATH
exec $JAVAEXE $THREADMODEL $JAVAOPTIONS -cp $CLASSPATH $MAINCLASS $*

