#!/bin/sh

# Script to start Flat
# Sets LD_LIBRARY_PATH so this command
# can be run remotely.
#
# CHANGE the definition of FLAT_PATH to move
#        it to another machine/host.

# Mike Hewett
# 13 Oct 1999

ARCH=`arch`

if [ "$ARCH" = "sun4" ]
then
  TARGET="sun"
else if [ "$ARCH" = "i686" ]
  then
    TARGET="linux"
  else
   echo "Flat: unknown architecture type - $ARCH"
   exit 1
  fi
fi

echo "Starting Flat for a ${TARGET} machine"

if [ "$TARGET" = "sun" ]
then
  LD_LIBRARY_PATH=/lusr/X11/lib:/usr/openwin/lib:${LD_LIBRARY_PATH}
  export LD_LIBRARY_PATH
  FLAT_PATH=/u/robot/flat-root/flat4/src
  FLAT_BINARY=flat_solaris_sparc
  ${FLAT_PATH}/${FLAT_BINARY} $*
else if [ "$TARGET" = "linux" ]
  then
    LD_LIBRARY_PATH=/lusr/X11/lib:/usr/openwin/lib:${LD_LIBRARY_PATH}
    export LD_LIBRARY_PATH
    FLAT_PATH=/u/robot/flat-root/flat4/src
    FLAT_BINARY=flat_linux_x86
    ${FLAT_PATH}/${FLAT_BINARY} $*
  else
    echo "ERROR: Internal error in the Flat script.  Unknown target (${TARGET})for Flat."
  fi
fi
