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