source: main/tags/2.41/gli/gli.sh@ 25339

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

Added an escapee "n".

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1#!/bin/sh
2
3
4## -------- Run the Greenstone Librarian Interface --------
5
6# This 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
11fi
12
13
14## ---- Determine GSDLHOME ----
15gsdlpath=
16
17# Some users may set the above line manually
18if [ "$gsdlpath" == "" ]; then
19 # Check the environment variable first
20 if [ "$GSDLHOME" != "" ]; then
21 gsdlpath=$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 gsdlpath=`pwd`
27 popd > /dev/null
28 fi
29fi
30
31# Check that the Greenstone installation looks OK
32echo "Checking GSDL: $gsdlpath"
33if [ ! -f "${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."
37 exit 1
38fi
39
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
46
47
48## ---- Check Perl exists ----
49perlpath=
50
51# Some users may set the above line manually
52if [ "$perlpath" == "" ]; then
53 # Check if Perl is on the search path
54 perlpath=`which perl 2> /dev/null`
55fi
56
57# Check that a Perl executable has been found
58echo "Checking Perl: $perlpath"
59if [ ! -x "$perlpath" ] ; then
60 echo
61 echo "The Greenstone 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."
64 exit 1
65fi
66
67
68## ---- Check Java exists ----
69javapath=
70
71# Some users may set the above line manually
72if [ "$javapath" == "" ]; then
73
74 # If it is set, use the JAVAHOME environment variable
75 if [ "$JAVAHOME" != "" ]; then
76 javapath="$JAVAHOME/bin/java"
77
78 # Check if Java is on the search path
79 else
80 javapath=`which java 2> /dev/null`
81 fi
82fi
83
84# Check that a Java executable has been found
85echo "Checking Java: $javapath"
86if [ ! -x "$javapath" ]; then
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."
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
108 echo
109 echo "The version of the Java Runtime Environment you have installed is too"
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."
112 exit 1
113fi
114
115
116## ---- Check that the GLI has been compiled ----
117if [ ! -f "classes/org/greenstone/gatherer/Gatherer.class" ] && [ ! -f "GLI.jar" ]; then
118 echo
119 echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
120 echo "before running this script."
121 exit 1
122fi
123
124
125## ---- Finally, run the GLI ----
126echo
127echo "Running the Greenstone Librarian Interface..."
128
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
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 $*
137
138echo "Done!"
Note: See TracBrowser for help on using the repository browser.