source: trunk/gli/gli.sh@ 6262

Last change on this file since 6262 was 6262, checked in by jmt12, 20 years ago

Corrected the launching scripts/batch files to say copyright 2003 - at least for 19 more days

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