#!/bin/sh
# Script to invoke XMLterm
# 1) as ./xmlterm from mozilla/dist/bin or the package directory, or
# 2) as xmlterm (invoking /usr/bin/xmlterm), if installed with RPM, or
# 3) as xmlterm, if dist/bin or package directory has been included in PATH

XMLTERM_CHROME="xmlterm.xul"
MOZILLA_BIN="./mozilla-bin"

# Determine command prefix
PREFIX=`dirname $0`

if [ "$PREFIX" = "." ]
then
   # Assume running in dist/bin or package directory (useful for testing)
   MOZILLA_DIR=`pwd`

else
   MOZILLA_DIR=""

   if [ -f /bin/rpm -a -f /usr/bin/xmlterm ]
   then
      # Try to find installation directory using RPM
      MOZILLA_DIR=`rpm -q --queryformat "%{INSTALLPREFIX}" xmlterm`
   fi

   if [ ! "$MOZILLA_DIR" ]
   then
      # Assume command prefix points to mozilla directory
      MOZILLA_DIR=$PREFIX
   fi
fi

echo cd $MOZILLA_DIR
cd $MOZILLA_DIR

echo ./run-mozilla.sh $MOZILLA_BIN -terminal
./run-mozilla.sh $MOZILLA_BIN -terminal
