#!/bin/sh ## -------- Run the Greenstone Librarian Interface -------- # This script must be run from within the directory in which it lives thisdir=`pwd` if [ ! -f "${thisdir}/gli.sh" ]; then echo "This script must be run from the directory in which it resides." exit 1 fi ## ---- Determine GSDLHOME ---- gsdlpath= # Some users may set the above line manually if [ "$gsdlpath" == "" ]; then # Check the environment variable first if [ "$GSDLHOME" != "" ]; then gsdlpath=$GSDLHOME # If it is not set, assume that the GLI is installed as a subdirectory of Greenstone else pushd .. > /dev/null gsdlpath=`pwd` popd > /dev/null fi fi # Check that the Greenstone installation looks OK echo "Checking GSDL: $gsdlpath" if [ ! -f "${gsdlpath}/setup.bash" ] ; then echo echo "The Greenstone installation could not be found, or is incomplete." echo "Try reinstalling Greenstone then running this script again." exit 1 fi # Setup Greenstone, unless it has already been done if [ "$GSDLHOME" == "" ]; then pushd $gsdlpath > /dev/null source setup.bash popd > /dev/null fi ## ---- Check Perl exists ---- perlpath= # Some users may set the above line manually if [ "$perlpath" == "" ]; then # Check if Perl is on the search path perlpath=`which perl 2> /dev/null` fi # Check that a Perl executable has been found echo "Checking Perl: $perlpath" if [ ! -x "$perlpath" ] ; then echo echo "The Greenstone Librarian Interface requires perl in order to operate," echo "but perl could not be detected on your system. Please ensure that perl" echo "is installed and is on your search path, then rerun this script." exit 1 fi ## ---- Check Java exists ---- javapath= # Some users may set the above line manually if [ "$javapath" == "" ]; then # If it is set, use the JAVAHOME environment variable if [ "$JAVAHOME" != "" ]; then javapath="$JAVAHOME/bin/java" # Check if Java is on the search path else javapath=`which java 2> /dev/null` fi fi # Check that a Java executable has been found echo "Checking Java: $javapath" if [ ! -x "$javapath" ]; then echo echo "Failed to locate an appropriate version of Java. You must install a" echo "Java Runtime Environment (version 1.4 or greater) before running the" echo "Greenstone Librarian Interface." exit 1 fi ## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI -- javaversion=`$javapath -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'` jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'` jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'` jok=1 if [ $jvmajor -lt 1 ] ; then jok=0 fi if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then jok=0 fi if [ $jok -eq 0 ] ; then echo echo "The version of the Java Runtime Environment you have installed is too" echo "old to run the Greenstone Librarian Interface. Please install a new" echo "version of the JRE (version 1.4 or newer) and rerun this script." exit 1 fi ## ---- Check that the GLI has been compiled ---- if [ ! -f "classes/org/greenstone/gatherer/Gatherer.class" ] && [ ! -f "GLI.jar" ]; then echo echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)" echo "before running this script." exit 1 fi ## ---- Finally, run the GLI ---- echo echo "Running the Greenstone Librarian Interface..." # -Xms32M To set minimum memory # -Xmx32M To set maximum memory # -verbose:gc To set garbage collection messages # -Xincgc For incremental garbage collection # -Xprof Function call profiling # -Xloggc: Write garbage collection log java -cp classes/:GLI.jar:lib/apache.jar:lib/calpa.jar:lib/jp.jar:lib/polloxml.jar:lib/qfslib.jar:lib/skinlf.jar:lib/nanoxml.jar org.greenstone.gatherer.Gatherer -gsdl $GSDLHOME $* echo "Done!"