#!/bin/sh

BIN_DIR=`dirname $0`
INSTALLATION_DIR="$BIN_DIR/.."
UPDATER_DIR="$INSTALLATION_DIR/updater"

java -jar "$INSTALLATION_DIR/lib/org.subshare.server-0.9.9-SNAPSHOT.jar" "$@"

if [ -d "$UPDATER_DIR" ]; then
	echo "Updating Subshare..."
	java -jar "$UPDATER_DIR/lib/org.subshare.updater-0.9.9-SNAPSHOT.jar" -installationDir "$INSTALLATION_DIR"
	"$0" "$@"
fi
