1 | #!/bin/sh
|
---|
2 |
|
---|
3 |
|
---|
4 | ## -- Run the Greenstone Librarian Interface --
|
---|
5 |
|
---|
6 | # 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 | gsdlhome=/research/mdewsnip/gsdl
|
---|
16 |
|
---|
17 | # Some users may set the above line manually
|
---|
18 | if [ "$gsdlhome" == "" ]; then
|
---|
19 | # Check the environment variable first
|
---|
20 | if [ "$GSDLHOME" != "" ]; then
|
---|
21 | gsdlhome=$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 | gsdlhome=`pwd`
|
---|
27 | popd > /dev/null
|
---|
28 | fi
|
---|
29 | fi
|
---|
30 |
|
---|
31 | # Check that the Greenstone installation looks OK
|
---|
32 | if [ ! -x "${gsdlhome}/setup.bash" ] ; then
|
---|
33 | echo "The Greenstone installation at ${gsdlhome} does not"
|
---|
34 | echo "appear to be complete. Try reinstalling Greenstone then running"
|
---|
35 | echo "this script again."
|
---|
36 | exit 1
|
---|
37 | fi
|
---|
38 |
|
---|
39 | # Setup Greenstone
|
---|
40 | pushd $gsdlhome > /dev/null
|
---|
41 | source setup.bash
|
---|
42 | echo
|
---|
43 | popd > /dev/null
|
---|
44 |
|
---|
45 |
|
---|
46 | ## -- Check Perl exists --
|
---|
47 | perlpath=
|
---|
48 |
|
---|
49 | # Some users may set the above line manually
|
---|
50 | if [ "$perlpath" == "" ]; then
|
---|
51 | # Try to find it on the search path
|
---|
52 | perlpath=`which perl 2> /dev/null`
|
---|
53 | fi
|
---|
54 |
|
---|
55 | if [ ! -x "$perlpath" ] ; then
|
---|
56 | echo "The Greestone Librarian Interface requires perl in order to operate but"
|
---|
57 | echo "this installation could not detect perl on your system. Please ensure"
|
---|
58 | echo "that perl is installed and is on your search path, then rerun this"
|
---|
59 | echo "script."
|
---|
60 | exit 1
|
---|
61 | fi
|
---|
62 |
|
---|
63 |
|
---|
64 | ## -- Check Java exists --
|
---|
65 | javapath=
|
---|
66 |
|
---|
67 | # Some users may set the above line manually
|
---|
68 | if [ "$javapath" == "" ]; then
|
---|
69 | # Check the environment variable first
|
---|
70 | if [ "$JAVAHOME" != "" ]; then
|
---|
71 | javapath="$JAVAHOME/bin/java"
|
---|
72 |
|
---|
73 | # If it is not set, hope it is on the search path
|
---|
74 | else
|
---|
75 | javapath=`which java 2> /dev/null`
|
---|
76 | fi
|
---|
77 | fi
|
---|
78 |
|
---|
79 | if [ ! -x "$javapath" ]; then
|
---|
80 | echo "Failed to locate Java. You must install a Java Runtime Environment"
|
---|
81 | echo "(version 1.4 or greater) before running the Greenstone Librarian Interface."
|
---|
82 | exit 1
|
---|
83 | fi
|
---|
84 |
|
---|
85 |
|
---|
86 | ## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
|
---|
87 | javaversion=`$javapath -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
|
---|
88 | jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
|
---|
89 | jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
|
---|
90 |
|
---|
91 | jok=1
|
---|
92 | if [ $jvmajor -lt 1 ] ; then
|
---|
93 | jok=0
|
---|
94 | fi
|
---|
95 | if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then
|
---|
96 | jok=0
|
---|
97 | fi
|
---|
98 | if [ $jok -eq 0 ] ; then
|
---|
99 | echo "The version of the Java Runtime Environment you have installed is too"
|
---|
100 | echo "old to run the Greenstone Librarian Interface. Please install a new version"
|
---|
101 | echo "of the JRE (version 1.4 or newer) and rerun this script."
|
---|
102 | exit 1
|
---|
103 | fi
|
---|
104 |
|
---|
105 |
|
---|
106 | ## -- Check that the GLI has been compiled --
|
---|
107 | if [ ! -f "classes/org/greenstone/gatherer/Gatherer.class" ]; then
|
---|
108 | echo "You need to compile the Greenstone Librarian Interface using makegli.sh"
|
---|
109 | echo "before running this script."
|
---|
110 | exit 1
|
---|
111 | fi
|
---|
112 |
|
---|
113 |
|
---|
114 | ## -- Finally, run the GLI --
|
---|
115 |
|
---|
116 | echo "Running the Greenstone Librarian Interface..."
|
---|
117 |
|
---|
118 | # -Xms32M To set minimum memory
|
---|
119 | # -Xmx32M To set maximum memory
|
---|
120 | # -verbose:gc To set garbage collection messages
|
---|
121 | # -Xincgc For incremental garbage collection
|
---|
122 | # -Xprof Function call profiling
|
---|
123 | # -Xloggc:<file> Write garbage collection log
|
---|
124 |
|
---|
125 | 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 $*
|
---|
126 |
|
---|
127 | echo "Done!"
|
---|