############################################################
#                                                          #
# Environment variable file for casa_atvd.                 #
#                                                          #
# Note: This file is sourced by the casa_atvd rc script    #
# when starting the service.                               #
#                                                          #
# The following variables are utilized by the daemon       #
# and its rc script:                                       #
#                                                          #
#   DAEMON_NO_AUTORESTART_AFTER_CRASH -                    #
#                                                          #
#   Set this variable to "1" if you want to disable the    #
#   auto-restart daemon after abnormal termination         #
#   feature. This variable is intended to facilitate       #
#   the discovery of problems during quality assurance     #
#   testing. Disabling of the auto-restart daemon after    #
#   abnormal termination feature will result in a          #
#   configuration that is less fault tolerant.             #
#                                                          #
#   DAEMON_COREDUMPS_WANTED -                              #
#                                                          #
#   Set this variable to allow core dumps to be taken      #
#   when a daemon terminates abnormally. This variable     #
#   is only meaningful when the auto-restart daemon        #
#   feature mentioned above is enabled. Core dumps are     #
#   allowed to be taken when the auto-restart daemon       #
#   feature is disabled. Core dumps of casa_atvd service   #
#   processes are taken to the                             #
#   /var/lib/CASA/authtoken/validate folder.               #
#                                                          #
############################################################
if [ -d /usr/lib64/jvm/jre ]; then
  LIB=lib64
  SUNLIBDIR=amd64
else
  LIB=lib
  SUNLIBDIR=i386
fi

TEST_IBM_JVM=$(/usr/$LIB/jvm/jre/bin/java -version 2>&1 | grep -i ibm)
if [ -z "${TEST_IBM_JVM}" ]; then
  # Assume Sun JVM
  JVM_VER=SUN
  if [ -z "${LD_LIBRARY_PATH}" ]; then
    LD_LIBRARY_PATH=/usr/$LIB/jvm/jre/lib/$SUNLIBDIR/server
  else
    LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}":/usr/$LIB/jvm/jre/lib/$SUNLIBDIR/server
  fi
else
  JVM_VER=IBM
  if [ -z "${LD_LIBRARY_PATH}" ]; then
    LD_LIBRARY_PATH=/usr/$LIB/jvm/jre/bin:/usr/$LIB/jvm/jre/bin/classic
  else
    LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}":/usr/$LIB/jvm/jre/bin:/usr/$LIB/jvm/jre/bin/classic
  fi
fi
export JVM_VER
export LD_LIBRARY_PATH