Changeset 4952 for trunk/gli/gli.sh


Ignore:
Timestamp:
2003-07-16T15:20:03+12:00 (21 years ago)
Author:
mdewsnip
Message:

First cut at a new and improved script for running the GLI. This incorporates most of the stuff from Install.sh, which is being removed. This script now:

  • Checks the script is run from within the directory it lives in
  • Checks if GSDLHOME is set
    • If not, assumes it is one level up (see below)
  • Checks Greenstone installation looks OK
  • Runs Greenstone's setup.bash
  • Checks if Perl exists on the search path
  • Checks if JAVAHOME is set
    • If not, searches for Java on the search path
  • Checks if the version of Java is sufficient to run the GLI (version 1.4.0 or higher)
  • Checks that the GLI has been compiled
  • Runs the GLI

Removing the Install.sh script should make things easier for everyone who doesn't get the GLI out of CVS. Since from now on the GLI will be distributed as a subdirectory of gsdl, I believe the assumption that if GSDLHOME isn't set, look one level up is a reasonable one.

In the case that the settings determined by this script aren't reasonable, I've allowed provision for them to be set manually in the script. Simply set the "gsdlhome=", "perlpath=", or "javapath=" variables, if necessary.

The library path variable has been moved into the GLI itself, but it will still be settable via the "-library" command line parameter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/gli.sh

    r4914 r4952  
    11#!/bin/sh
    2 echo "Running The Gatherer..."
    32
    4 if [ "x$GSDLHOME" = "x" ] ; then
    5   echo "Setting GSDLHOME..."
    6   pushd "/research/mdewsnip/gsdl"
    7   source setup.bash
    8   popd
     3
     4##  -- Run the Greenstone Librarian Interface --
     5
     6# Script must be run from within the directory in which it lives
     7thisdir=`pwd`
     8if [ ! -f "${thisdir}/gli.sh" ]; then
     9    echo "This script must be run from the directory in which it resides."
     10    exit 1
    911fi
     12
     13
     14##  -- Determine GSDLHOME --
     15gsdlhome=/research/mdewsnip/gsdl
     16
     17# Some users may set the above line manually
     18if [ "$gsdlhome" == "" ]; then
     19    # Check the environment variable first
     20    if [ "$GSDLHOME" != "" ]; then
     21    gsdlhome=$GSDLHOME
     22
     23    # If it is not set, assume that the GLI is installed as a subdirectory of Greenstone
     24    else
     25    pushd .. > /dev/null
     26    gsdlhome=`pwd`
     27    popd > /dev/null
     28    fi
     29fi
     30
     31# Check that the Greenstone installation looks OK
     32if [ ! -x "${gsdlhome}/setup.bash" ] ; then
     33    echo "The Greenstone installation at ${gsdlhome} does not"
     34    echo "appear to be complete. Try reinstalling Greenstone then running"
     35    echo "this script again."
     36    exit 1
     37fi
     38
     39# Setup Greenstone
     40pushd $gsdlhome > /dev/null
     41source setup.bash
     42echo
     43popd > /dev/null
     44
     45
     46##  -- Check Perl exists --
     47perlpath=
     48
     49# Some users may set the above line manually
     50if [ "$perlpath" == "" ]; then
     51    # Try to find it on the search path
     52    perlpath=`which perl 2> /dev/null`
     53fi
     54
     55if [ ! -x "$perlpath" ] ; then
     56    echo "The Greestone Librarian Interface requires perl in order to operate but"
     57    echo "this installation could not detect perl on your system. Please ensure"
     58    echo "that perl is installed and is on your search path, then rerun this"
     59    echo "script."
     60    exit 1
     61fi
     62
     63
     64## -- Check Java exists --
     65javapath=
     66
     67# Some users may set the above line manually
     68if [ "$javapath" == "" ]; then
     69    # Check the environment variable first
     70    if [ "$JAVAHOME" != "" ]; then
     71    javapath="$JAVAHOME/bin/java"
     72
     73    # If it is not set, hope it is on the search path
     74    else
     75    javapath=`which java 2> /dev/null`
     76    fi
     77fi
     78
     79if [ ! -x "$javapath" ]; then
     80    echo "Failed to locate Java. You must install a Java Runtime Environment"
     81    echo "(version 1.4 or greater) before running the Greenstone Librarian Interface."
     82    exit 1
     83fi
     84
     85
     86## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
     87javaversion=`$javapath -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
     88jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
     89jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
     90
     91jok=1
     92if [ $jvmajor -lt 1 ] ; then
     93    jok=0
     94fi
     95if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then
     96    jok=0
     97fi
     98if [ $jok -eq 0 ] ; then
     99    echo "The version of the Java Runtime Environment you have installed is too"
     100    echo "old to run the Greenstone Librarian Interface. Please install a new version"
     101    echo "of the JRE (version 1.4 or newer) and rerun this script."
     102    exit 1
     103fi
     104
     105
     106## -- Check that the GLI has been compiled --
     107if [ ! -x "classes/org/greenstone/gatherer/Gatherer.class" ]; then
     108    echo "You need to compile the Greenstone Librarian Interface using makegli.sh"
     109    echo "before running this script."
     110    exit 1
     111fi
     112
     113
     114## -- Finally, run the GLI --
     115
     116echo "Running the Greenstone Librarian Interface..."
    10117
    11118# -Xms32M          To set minimum memory
     
    16123# -Xloggc:<file>   Write garbage collection log
    17124
    18 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 -library bedrock.cs.waikato.ac.nz:9090/gsdl/cgi-bin/ $*
     125java -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 $*
    19126
    20127echo "Done!"
    21 
Note: See TracChangeset for help on using the changeset viewer.