#
# This script launches the SKIT (SSL) key management program with
# the correct options.
#
# Launch gsk*ikm, pointing it to the class used to provide help.
# The class path is set up so that it will pick the right help file
# depending on the setting of LANG.

MACH=`uname -m`
if [[ $MACH = i686 || $MACH = x86_64 ]]
then
  JAVA_VERSION=IBMJava2-142
fi
if [[ $MACH = ppc64 ]]
then
  JAVA_VERSION=IBMJava2-ppc-142
fi
if [[ $MACH = s390 || $MACH = s390x ]]
then
  JAVA_VERSION=IBMJava2-s390-142
fi

GSKIKM="gsk7ikm"

# save/set JAVA_COMPILER
OLD_JAVA_COMPILER=$JAVA_COMPILER
export JAVA_COMPILER=NONE

cd /etc/opt/ibm/sna
export JAVA_HOME=/opt/ibm/sna/$JAVA_VERSION/jre
SHORT_LANG=`echo $LANG | awk '{print substr($1,0,5)}'`
$GSKIKM $* -Dkeyman.helpClassName=CSSgKey.class -cp /opt/ibm/sna/lib/nls/msg/C -cp /opt/ibm/sna/lib/nls/msg/$SHORT_LANG -cp /opt/ibm/sna/lib/sguides.jar -cp /opt/ibm/sna/lib

# restore JAVA_COMPILER if it was set
unset JAVA_COMPILER
if [ "x$OLD_JAVA_COMPILER" != "x" ]
then
  export JAVA_COMPILER=$OLD_JAVA_COMPILER
fi

exit 0
