source: trunk/gli/gli.sh@ 5003

Last change on this file since 5003 was 5003, checked in by mdewsnip, 21 years ago

Minor changes to make the script more similar to the Windows batch file.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
RevLine 
[4914]1#!/bin/sh
2
[4952]3
[5003]4## -------- Run the Greenstone Librarian Interface --------
[4952]5
[5003]6# This script must be run from within the directory in which it lives
[4952]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
[4914]11fi
12
[4952]13
[5003]14## ---- Determine GSDLHOME ----
15gsdlpath=
[4952]16
17# Some users may set the above line manually
[5003]18if [ "$gsdlpath" == "" ]; then
[4952]19 # Check the environment variable first
20 if [ "$GSDLHOME" != "" ]; then
[5003]21 gsdlpath=$GSDLHOME
[4952]22
23 # If it is not set, assume that the GLI is installed as a subdirectory of Greenstone
24 else
25 pushd .. > /dev/null
[5003]26 gsdlpath=`pwd`
[4952]27 popd > /dev/null
28 fi
29fi
30
31# Check that the Greenstone installation looks OK
[5003]32echo "Checking GSDL: $gsdlpath"
33if [ ! -x "${gsdlpath}/setup.bash" ] ; then
34 echo
35 echo "The Greenstone installation could not be found, or is incomplete."
36 echo "Try reinstalling Greenstone then running this script again."
[4952]37 exit 1
38fi
39
[5003]40# Setup Greenstone, unless it has already been done
41if [ "$GSDLHOME" == "" ]; then
42 pushd $gsdlpath > /dev/null
43 source setup.bash
44 popd > /dev/null
45fi
[4952]46
47
[5003]48## ---- Check Perl exists ----
[4952]49perlpath=
50
51# Some users may set the above line manually
52if [ "$perlpath" == "" ]; then
[5003]53 # Check if Perl is on the search path
[4952]54 perlpath=`which perl 2> /dev/null`
55fi
56
[5003]57# Check that a Perl executable has been found
58echo "Checking Perl: $perlpath"
[4952]59if [ ! -x "$perlpath" ] ; then
[5003]60 echo
61 echo "The Greestone Librarian Interface requires perl in order to operate,"
62 echo "but perl could not be detected on your system. Please ensure that perl"
63 echo "is installed and is on your search path, then rerun this script."
[4952]64 exit 1
65fi
66
67
[5003]68## ---- Check Java exists ----
[4952]69javapath=
70
71# Some users may set the above line manually
72if [ "$javapath" == "" ]; then
[5003]73
74 # If it is set, use the JAVAHOME environment variable
[4952]75 if [ "$JAVAHOME" != "" ]; then
76 javapath="$JAVAHOME/bin/java"
77
[5003]78 # Check if Java is on the search path
[4952]79 else
80 javapath=`which java 2> /dev/null`
81 fi
82fi
83
[5003]84# Check that a Java executable has been found
85echo "Checking Java: $javapath"
[4952]86if [ ! -x "$javapath" ]; then
[5003]87 echo
88 echo "Failed to locate an appropriate version of Java. You must install a"
89 echo "Java Runtime Environment (version 1.4 or greater) before running the"
90 echo "Greenstone Librarian Interface."
[4952]91 exit 1
92fi
93
94
95## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
96javaversion=`$javapath -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
97jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
98jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
99
100jok=1
101if [ $jvmajor -lt 1 ] ; then
102 jok=0
103fi
104if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then
105 jok=0
106fi
107if [ $jok -eq 0 ] ; then
[5003]108 echo
[4952]109 echo "The version of the Java Runtime Environment you have installed is too"
[5003]110 echo "old to run the Greenstone Librarian Interface. Please install a new"
111 echo "version of the JRE (version 1.4 or newer) and rerun this script."
[4952]112 exit 1
113fi
114
115
[5003]116## ---- Check that the GLI has been compiled ----
[4956]117if [ ! -f "classes/org/greenstone/gatherer/Gatherer.class" ]; then
[5003]118 echo
119 echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
[4952]120 echo "before running this script."
121 exit 1
122fi
123
124
[5003]125## ---- Finally, run the GLI ----
126echo
[4952]127echo "Running the Greenstone Librarian Interface..."
128
[4914]129# -Xms32M To set minimum memory
130# -Xmx32M To set maximum memory
131# -verbose:gc To set garbage collection messages
132# -Xincgc For incremental garbage collection
133# -Xprof Function call profiling
134# -Xloggc:<file> Write garbage collection log
135
[4952]136java -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 $*
[4914]137
138echo "Done!"
Note: See TracBrowser for help on using the repository browser.