#!/bin/sh
# Start the GoPrint4 service which brings a GTX and Agent online by default.
# See the gtx-agent.conf and *.conf files for parameters and notes on Java installation.
#
# A symbolic link or actual directory must exist at ../jre, and must lead to
# a full Java JDK, not just a JRE, for the GTX service to operate.
#
# Add '-c' to the command-line to run in console

args="$1"
runconf="gtx-agent.conf"

bindir=`dirname $0`
if [ ! -e "$bindir/../jre" ]; then
  echo "Please make a 'jre' symlink in the $bindir/.. installation directory that"
  echo "references an Oracle Java installation."
  exit 1
fi

uname=`uname`
wrapper="$bindir/wrapper"
if [ "$uname" = "Darwin" ] ; then
  wrapper="$bindir/wrapper-macosx-universal-32"
fi
if [ ! -e $wrapper ]; then
  echo "Please make a 'wrapper' symlink in the $bindir directory that references"
  echo "one of the wrapper-* executables.  For example:"
  echo "   cd gs4/bin && ln -s wrapper-linux-x86-32 wrapper"
  exit 1
fi

$wrapper $args $runconf

