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
|
---|
7 | thisdir=`pwd`
|
---|
8 | if [ ! -f "${thisdir}/gli.sh" ]; then
|
---|
9 | echo "This script must be run from the directory in which it resides."
|
---|
10 | exit 1
|
---|
11 | fi
|
---|
12 |
|
---|
13 |
|
---|
14 | ## ---- Determine GSDLHOME ----
|
---|
15 | gsdlpath=
|
---|
16 |
|
---|
17 | # Some users may set the above line manually
|
---|
18 | if [ "$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
|
---|
29 | fi
|
---|
30 |
|
---|
31 | # Check that the Greenstone installation looks OK
|
---|
32 | echo "Checking GSDL: $gsdlpath"
|
---|
33 | if [ ! -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
|
---|
38 | fi
|
---|
39 |
|
---|
40 | # Setup Greenstone, unless it has already been done
|
---|
41 | if [ "$GSDLHOME" == "" ]; then
|
---|
42 | pushd $gsdlpath > /dev/null
|
---|
43 | source setup.bash
|
---|
44 | popd > /dev/null
|
---|
45 | fi
|
---|
46 |
|
---|
47 |
|
---|
48 | ## ---- Check Perl exists ----
|
---|
49 | perlpath=
|
---|
50 |
|
---|
51 | # Some users may set the above line manually
|
---|
52 | if [ "$perlpath" == "" ]; then
|
---|
53 | # Check if Perl is on the search path
|
---|
54 | perlpath=`which perl 2> /dev/null`
|
---|
55 | fi
|
---|
56 |
|
---|
57 | # Check that a Perl executable has been found
|
---|
58 | echo "Checking Perl: $perlpath"
|
---|
59 | if [ ! -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
|
---|
65 | fi
|
---|
66 |
|
---|
67 |
|
---|
68 | ## ---- Check Java exists ----
|
---|
69 | javapath=
|
---|
70 |
|
---|
71 | # Some users may set the above line manually
|
---|
72 | if [ "$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
|
---|
82 | fi
|
---|
83 |
|
---|
84 | # Check that a Java executable has been found
|
---|
85 | echo "Checking Java: $javapath"
|
---|
86 | if [ ! -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
|
---|
92 | fi
|
---|
93 |
|
---|
94 |
|
---|
95 | ## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
|
---|
96 | javaversion=`$javapath -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
|
---|
97 | jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
|
---|
98 | jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
|
---|
99 |
|
---|
100 | jok=1
|
---|
101 | if [ $jvmajor -lt 1 ] ; then
|
---|
102 | jok=0
|
---|
103 | fi
|
---|
104 | if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then
|
---|
105 | jok=0
|
---|
106 | fi
|
---|
107 | if [ $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
|
---|
113 | fi
|
---|
114 |
|
---|
115 |
|
---|
116 | ## ---- Check that the GLI has been compiled ----
|
---|
117 | if [ ! -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
|
---|
122 | fi
|
---|
123 |
|
---|
124 |
|
---|
125 | ## ---- Finally, run the GLI ----
|
---|
126 | echo
|
---|
127 | echo "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 |
|
---|
136 | 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 $*
|
---|
137 |
|
---|
138 | echo "Done!"
|
---|