Source

quixote-client / src / main / bin / qc.sh

Full commit
#!/bin/sh
# Chempound Client CLI Start-up File
# Copyright (c) Sam Adams 2011
# Inspired by Apache Maven Project

# Required ENV vars:
# JAVA_HOME - location of a JDK home dir

if [ -z "$JAVA_HOME" ] ; then
  echo "Warning: JAVA_HOME environment variable is not set."
fi


if [ -z "$CPCLIENT_HOME" ] ; then
  ## resolve links - $0 may be a link to Chempound Client's home
  PRG="$0"

  # need this for relative symlinks
  while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
      PRG="$link"
    else
      PRG="`dirname "$PRG"`/$link"
    fi
  done

  saveddir=`pwd`

  CPCLIENT_HOME=`dirname "$PRG"`/..

  # make it fully qualified
  CPCLIENT_HOME=`cd "$CPCLIENT_HOME" && pwd`

  cd "$saveddir"
fi

exec "$JAVA_HOME/bin/java" \
  $CPCLIENT_OPTS \
  -classpath "$CPCLIENT_HOME/lib/*" \
  -Dcpclient.home="$CPCLIENT_HOME" \
  -Dlog4j.configuration=qc-log4j.properties \
  uk.ac.cam.ch.wwmm.quixote.client.QuixoteClientCLI $*