#!/bin/bash -f
if [[ "$0" -ef "${PROMAX_HOME}/linux64/exe/exec.exe" ]]; then
  echo ' '
  echo '********************************************************************************'
  echo 'FATAL INSTALLATION ERROR:'
  echo ' '
  echo "${PROMAX_HOME}/linux64/exe/exec.exe appears to have been replaced with an Alternate Executive."
  echo ' '
  echo 'Restore the original IMMEDIATELY!  No ProMAX jobs can run until this is done.'
  echo ' '
  echo '********************************************************************************'
  echo ' '
  exit 1
fi
# Use the PROMAX_RUNTIME_DIRECTORY which gets automatically removed when the job is done.
declare templd="${PROMAX_RUNTIME_DIRECTORY:-/tmp}"
trap 'exit' HUP INT QUIT TERM
cat $0 | ( cd "${templd}" ; uudecode ; tar xpf execlibs.tar )
/bin/rm -f "${templd}/execlibs.tar"
export LD_LIBRARY_PATH="${templd}":${LD_LIBRARY_PATH}
exec "${PROMAX_HOME}/linux64/exe/exec.exe" "$@"
exit $?
