#!/bin/bash

CMDNAME=`basename "$0"`

usage() {
    echo "Usage: ${CMDNAME} [-h|--help] [-d data_dir] [solr_home]" 1>&2
    exit 1
}

SOLR_PATH=@solr_path@
SOLR_HOME=@solr_home@
SOLR_DATA=${SOLR_HOME}/data

while test -n "$1"; do
    case "$1" in
        -h|--help) usage ;;
        -d|--datadir) shift 
                   SOLR_DATA=$1;;
        *)         SOLR_HOME="$1";;
    esac
    shift
done

java -Dsolr.clustering.enabled=true \
     -Dsolr.solr.home="${SOLR_HOME}" \
     -Dsolr.data.dir="${SOLR_DATA}" \
     -Djetty.home="${SOLR_PATH}" \
     -jar ${SOLR_PATH}/start.jar
