source: trunk/gli/gli.sh@ 6223

Last change on this file since 6223 was 6223, checked in by mdewsnip, 20 years ago

Added a blank line after the GPL message.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1#!/bin/sh
2
3echo 'Greenstone Librarian Interface (GLI)'
4echo 'Copyright (C) 2002 Greenstone Digital Libraries, University Of Waikato'
5echo 'GLI comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt'
6echo 'This is free software, and you are welcome to redistribute it'
7echo
8
9## -------- Run the Greenstone Librarian Interface --------
10
11# This script must be run from within the directory in which it lives
12thisdir=`pwd`
13if [ ! -f "${thisdir}/gli.sh" ]; then
14 echo "This script must be run from the directory in which it resides."
15 exit 1
16fi
17
18
19## ---- Determine GSDLHOME ----
20gsdlpath=/research/jmt12/gsdl
21
22# Some users may set the above line manually
23if [ "$gsdlpath" == "" ]; then
24 # Check the environment variable first
25 if [ "$GSDLHOME" != "" ]; then
26 gsdlpath=$GSDLHOME
27
28 # If it is not set, assume that the GLI is installed as a subdirectory of Greenstone
29 else
30 pushd .. > /dev/null
31 gsdlpath=`pwd`
32 popd > /dev/null
33 fi
34fi
35
36# Check that the Greenstone installation looks OK
37echo "Checking GSDL: $gsdlpath"
38if [ ! -f "${gsdlpath}/setup.bash" ] ; then
39 echo
40 echo "The Greenstone installation could not be found, or is incomplete."
41 echo "Try reinstalling Greenstone then running this script again."
42 exit 1
43fi
44
45# Setup Greenstone, unless it has already been done
46if [ "$GSDLHOME" == "" ]; then
47 pushd $gsdlpath > /dev/null
48 source setup.bash
49 popd > /dev/null
50fi
51
52
53## ---- Check Perl exists ----
54perlpath=
55
56# Some users may set the above line manually
57if [ "$perlpath" == "" ]; then
58 # Check if Perl is on the search path
59 perlpath=`which perl 2> /dev/null`
60fi
61
62# Check that a Perl executable has been found
63echo "Checking Perl: $perlpath"
64if [ ! -x "$perlpath" ] ; then
65 echo
66 echo "The Greenstone Librarian Interface requires perl in order to operate,"
67 echo "but perl could not be detected on your system. Please ensure that perl"
68 echo "is installed and is on your search path, then rerun this script."
69 exit 1
70fi
71
72
73## ---- Check Java exists ----
74javapath=
75
76# Some users may set the above line manually
77if [ "$javapath" == "" ]; then
78
79 # If it is set, use the JAVAHOME environment variable
80 if [ "$JAVAHOME" != "" ]; then
81 javapath="$JAVAHOME/bin/java"
82
83 # Check if Java is on the search path
84 else
85 javapath=`which java 2> /dev/null`
86 fi
87fi
88
89# Check that a Java executable has been found
90echo "Checking Java: $javapath"
91if [ ! -x "$javapath" ]; then
92 echo
93 echo "Failed to locate an appropriate version of Java. You must install a"
94 echo "Java Runtime Environment (version 1.4 or greater) before running the"
95 echo "Greenstone Librarian Interface."
96 exit 1
97fi
98
99
100## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
101javaversion=`$javapath -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
102jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
103jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
104
105jok=1
106if [ $jvmajor -lt 1 ] ; then
107 jok=0
108fi
109if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then
110 jok=0
111fi
112if [ $jok -eq 0 ] ; then
113 echo
114 echo "The version of the Java Runtime Environment you have installed is too"
115 echo "old to run the Greenstone Librarian Interface. Please install a new"
116 echo "version of the JRE (version 1.4 or newer) and rerun this script."
117 exit 1
118fi
119
120
121## ---- Check that the GLI has been compiled ----
122if [ ! -f "classes/org/greenstone/gatherer/Gatherer.class" ] && [ ! -f "GLI.jar" ]; then
123 echo
124 echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
125 echo "before running this script."
126 exit 1
127fi
128
129if [ "$1" == "-test" ]; then
130 echo "Testing class: $2"
131 echo "arguments $*"
132 java -classpath classes/:GLI.jar:lib/apache.jar:lib/calpa.jar:lib/jp.jar:lib/polloxml.jar:lib/qfslib.jar:lib/skinlf.jar $2 $3
133 exit 1
134fi
135
136## ---- Finally, run the GLI ----
137echo
138echo "Running the Greenstone Librarian Interface..."
139
140# Other arguments you can provide to GLI to work around memory limitations, or debug
141# -Xms<number>M To set minimum memory (by default 32MB)
142# -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
143# -verbose:gc To set garbage collection messages
144# -Xincgc For incremental garbage collection (significantly slows performance)
145# -Xprof Function call profiling
146# -Xloggc:<file> Write garbage collection log
147
148java -classpath classes/:GLI.jar:lib/apache.jar:lib/calpa.jar:lib/jp.jar:lib/polloxml.jar:lib/qfslib.jar:lib/skinlf.jar org.greenstone.gatherer.Gatherer -gsdl $GSDLHOME $*
149
150echo "Done!"
Note: See TracBrowser for help on using the repository browser.