#!/bin/sh
TH1ISH_HOME=`dirname "$0"`
TH1ISH_SHELL=$TH1ISH_HOME/fossi1ish
TH1ISH_MODULE_PATH=".:$TH1ISH_HOME"
TH1ISH_SCRIPT_PATH=".:$TH1ISH_HOME"
#TH1ISH_AUTOLOAD_MODULES="module1,module2,module3"
PROXY_SCRIPT=$TH1ISH_HOME/cgi-proxy.th1ish
export TH1ISH_MODULE_PATH TH1ISH_SCRIPT_PATH TH1ISH_AUTOLOAD_MODULES

# For libfossil.so:
LD_LIBRARY_PATH="${TH1ISH_HOME}/..:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH

#TH1ISH_CGI_REPO="-R=${TH1ISH_HOME}/../../libfossil.fsl"
if [ -d $HOME/fossil ]; then
    TH1ISH_CGI_REPO="-R=$HOME/fossil/libfossil.fsl"
else
    TH1ISH_CGI_REPO="-R=$TH1ISH_HOME/../../libfossil.fsl"
    #TH1ISH_CGI_REPO="-R=$TH1ISH_HOME/../../fossil.fsl"
fi

TH1ISH_REPO_URL=http://fossil.wanderinghorse.net/repos/libfossil/index.cgi
#TH1ISH_CGI_REPO=-C
TH1ISH_SCRIPT_FLAGS="${TH1ISH_CGI_REPO} --repo-url=${TH1ISH_REPO_URL}"
#TH1ISH_SCRIPT_FLAGS="${TH1ISH_SCRIPT_FLAGS} --repo-url=http://url-to-your/repo[.cgi]"
TH1ISH_SHELL_FLAGS="-c -a -L -x -f -t -p --l -L"

exec $TH1ISH_SHELL ${TH1ISH_SHELL_FLAGS} -f $PROXY_SCRIPT -- $TH1ISH_SCRIPT_FLAGS
