#!/bin/ksh
# The prodreg command, designed to simply run the Java 
# code in as many different systems as possible
# @(#)sdtprodreg.sh	1.4 00/07/23 14:44:55
PRODREG_HOME=`dirname $0`/../appconfig/sdtprodreg

LD_LIBRARY_PATH=$PRODREG_HOME/lib:/usr/snadm/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH

#
if [ "$1" = "swing" ] ; then
  # want to preserve the classpath in case the user has swing on it
  java -mx64m -Dprodreg.home=$PRODREG_HOME \
    -Dprodreg.pkgroot=$PKG_INSTALL_ROOT \
    -Djava.library.path=$PRODREG_HOME/lib \
    -classpath $PRODREG_HOME/classes/prodreg.jar:/usr/sadm/smc/lib/swingall.jar:$CLASSPATH \
    com.sun.prodreg.core.ProdReg $*
  exit 0
fi

if [ ! -z "$JRE_HOME" ]; then
  $JRE_HOME/bin/jre -mx64m -Dprodreg.home=$PRODREG_HOME \
    -Dprodreg.pkgroot=$PKG_INSTALL_ROOT \
    -Djava.library.path=$PRODREG_HOME/lib \
    -cp .:$PRODREG_HOME/classes/prodreg.jar com.sun.prodreg.core.ProdReg $*
  exit 0
fi

if [ -z "$JAVA_HOME" ]; then
  export JAVA_HOME=/usr/java
fi

$JAVA_HOME/bin/java -mx64m -Dprodreg.home=$PRODREG_HOME \
  -Dprodreg.pkgroot=$PKG_INSTALL_ROOT \
  -classpath \
  .:$PRODREG_HOME/classes/prodreg.jar:/usr/java/lib/classes.zip \
  -Djava.library.path=$PRODREG_HOME/lib \
  com.sun.prodreg.core.ProdReg $*
exit 0
