#!/bin/ksh
#
# update - find a patch file and install it

# NOTE: the update launcher cannot use any jar files in Fiper.
# This locks the jar files.
# This also means that the patch installer itself must NOT use any part of Fiper
# other than the JRE.

# see IR-128441
FIPER_MEM=200M
export FIPER_MEM

dir=`command -v $0`
dir=`dirname $dir`
. "$dir/fiperenv"

# Copy needed Jar files to temporary location to prevent them from being locked.
ptemp="$FIPER_HOME/update/temp"
rm -rf "$ptemp"
mkdir -p "$ptemp"
cp "$FIPER_HOME/docs/java/SMAFIPupdate.jar" "$ptemp"
cp "$FIPER_HOME/docs/java/SMAFIPsdk.jar"    "$ptemp"
cp "$FIPER_HOME/docs/java/SMAFIPcommon.jar" "$ptemp"
cp "$FIPER_HOME/docs/java/SMAFIPsystemsdk.jar" "$ptemp"
cp "$FIPER_HOME/docs/java/Resources/SMAFIPupdate.properties" "$ptemp"
cp "$FIPER_HOME/docs/java/Resources/SMAFIPupdate_ja.properties" "$ptemp"

LaunchPgm=com.engineous.client.update.Update
LaunchClasspath="$ptemp:$ptemp/SMAFIPupdate.jar:$ptemp/SMAFIPsdk.jar:$ptemp/SMAFIPcommon.jar:$ptemp/SMAFIPsystemsdk.jar"
JVMParms="'-Dfiper.system.esihome=$FIPER_HOME' $JVMParms"

# NOTE: eval required so single-quotes inside parameter values will
# actually quote the arguments.
eval java ${JVMParms} -classpath "'$LaunchClasspath'" ${LaunchPgm} "$@"
