#!/bin/sh serverlang=en java_min_version=1.4.0_00 function autoset_gsdl_home() { # remove leading ./ if present prog=${0#./} isrelative=${prog%%/*} if [ ! -z $isrelative ] ; then # some text is left after stripping # => is relative pwd=$PWD prog="$pwd/$prog" fi fulldir=${prog%/*} # remove trailing /. if present eval $1=${fulldir%/.} } function isinpath() { for file in `echo $1 | sed 's/:/ /g'`; do if [ "$file" == "$2" ]; then echo true return fi done echo false } echo "Greenstone 2 Server" echo "Copyright (C) 2009, New Zealand Digital Library Project, University Of Waikato" echo "This software comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt" echo "This is free software, and you are welcome to redistribute it" ## -------- Run the Greenstone 2 Server -------- ## ---- Determine GSDLHOME ---- gsdl2path= # Some users may set the above line manually if [ -z "$gsdl2path" ]; then autoset_gsdl_home gsdl2path fi # Setup Greenstone2, unless it has already been done if [ -z "$GSDLHOME" ]; then pushd $gsdl2path > /dev/null source setup.bash popd > /dev/null fi # JRE_HOME or JAVA_HOME must be set correctly to run this program search4j -m $java_min_version &> /dev/null if [ "$?" == "0" ]; then # In Java code, '...getResourceAsStream("build.properties")' # needs up to be in the right directory when run pushd $gsdl2path > /dev/null #CLASSPATH if [ `isinpath "$CLASSPATH" "$GSDLHOME/lib/java"` == "false" ]; then CLASSPATH=$GSDLHOME/lib/java:$CLASSPATH for JARFILE in $GSDLHOME/lib/java/*.jar; do CLASSPATH=$CLASSPATH:$JARFILE done export CLASSPATH echo " - Adjusted CLASSPATH" else echo " - CLASSPATH already correct" fi javapath=`search4j -m $java_min_version -e` $javapath org.greenstone.server.Server2 $GSDLHOME $serverlang popd > /dev/null fi