#!/bin/bash

. ${TOOLKIT}-functions.sh

repodir=`jtconf fossil.repodir`		|| exit_missing_define fossil.repodir
webserver=`jtconf fossil.server`	|| exit_missing_define fossil.server

# is this the server?
#
uname=`uname`
shortname=`echo $uname | sed -e 's/\..*//'`

[ $uname == $webserver -o $shortname == $webserver ] || exit 0

vdir=`jtconf apache.autovirtual_root`	|| exit_missing_define apache.autovirtual_root
cgidir="$vdir/$webserver/cgi-bin"

[ -d $cgidir ] || {
	echo "directory '$cgidir' not found, is this the correct server?"
	exit_err 1
}

installfile "fossil.cgi" "$cgidir/fossil" "www-data.www-data" 0755 || exit_err $?

exit 0
