#!/bin/sh

PUB_TARGET="$1"
PUB_BUILD="$2"
PUB_SOURCE="$3"

CLASSPATH="/usr/local/share/java/jope-1.3.jar:/usr/local/share/java/pubexport-0.9.10.jar"

MIMETYPES="()"
EXPORTER="org.opengroupware.pubexport.pubexport"

if ! test -d "$PUB_TARGET"; then
  echo "$0: target directory $PUB_TARGET does not exist or is not a directory!"
  exit 1
fi
if ! test -d $PUB_BUILD; then
  echo "$0: build directory $PUB_BIILD  does not exist or is not a directory!"
  exit 2
fi

cd $PUB_BUILD

echo "export: "
echo "  build:  $PUB_BUILD ($PWD)"
echo "  target: $PUB_TARGET"
echo "  source: $PUB_SOURCE"

nice -n 19 java -cp "${CLASSPATH}" "${EXPORTER}" "$PUB_BUILD" "$PUB_TARGET"
