source: gli/trunk/gli.sh@ 20551

Last change on this file since 20551 was 19769, checked in by ak19, 15 years ago
  1. Search4j was previously given a hint that assumed that findjava was working with GLI instead of a more general case (such as gs2-server.sh). Now it is uses GSDLHOME to work out the hint. 2. PROGNAME needs to be passed in as a parameter for display. The scripts gli.sh and client-gli.sh are now updated to pass PROGNAME (or PROGABBR) as an additional argument to findjava.sh. 3. Instead of merely testing whether the search4j file exists, Oran suggested testing whether search4j file exists AND is executable.
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.9 KB
RevLine 
[18634]1#!/bin/bash
[15610]2
[6752]3glilang=en
[13251]4
[14977]5if [ "x$PROGNAME" = "x" ] ; then
6 if [ "$glilang" = "es" ]; then
7 PROGNAME="Biblioteca Digital Greenstone"
8 elif [ "$glilang" = "fr" ]; then
9 PROGNAME="Bibliothécaire Greenstone"
10 elif [ "$glilang" = "ru" ]; then
11 PROGNAME="ÉÎÔÅÒÆÅÊÓ Greenstone"
12 else
13 PROGNAME="Greenstone Librarian Interface"
14 fi
15fi
16
17if [ "x$PROGABBR" = "x" ] ; then
18 PROGABBR="GLI"
19fi
20
21if [ "x$PROGNAME_EN" = "x" ] ; then
22 PROGNAME_EN="Greenstone Librarian Interface"
23fi
24
[19403]25if [ "x$GLIMODE" = "x" ] ; then
26 GLIMODE="local"
27fi
28
[6262]29echo
[12286]30if [ "$glilang" = "es" ]; then
[14977]31 echo "Interfaz de la $PROGNAME ($PROGNAME_EN - $PROGABBR)"
[12453]32 echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
[14977]33 echo "La Interfaz de la $PROGNAME NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÍA."
[6959]34 echo "Para mayor información vea los términos de la licencia en LICENSE.txt"
35 echo "Este es un software abierto, por lo que lo invitamos a que lo distribuya de forma gratuita"
[12286]36elif [ "$glilang" = "fr" ]; then
[14977]37 echo "Interface du $PROGNAME ($PROGNAME_EN - $PROGABBR)"
[12453]38 echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
[14977]39 echo "$PROGABBR est fourni sans AUCUNE GARANTIE; pour des détails, voir LICENSE.txt"
[6955]40 echo "Ceci est un logiciel libre, et vous êtes invité à le redistribuer"
[12286]41elif [ "$glilang" = "ru" ]; then
[14977]42 echo "âÉÂÌÉÏÔÅÞÎÙÊ $PROGNAME ($PROGNAME_EN - $PROGABBR)"
[12453]43 echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
[7041]44 echo "âéç ÎÅ ÄÁÅÔ áâóïìàôîï îéëáëéè çáòáîôéê; ÄÅÔÁÌÉ ÓÍ. × ÔÅËÓÔÅ LICENSE.TXT"
45 echo "üÔÏ - Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ É ÷Ù ÍÏÖÅÔÅ ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÇÏ"
[6702]46else
[14977]47 echo "$PROGNAME ($PROGABBR)"
[12453]48 echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
[14977]49 echo "$PROGABBR comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
[6955]50 echo "This is free software, and you are welcome to redistribute it"
[6702]51fi
[6223]52echo
[4952]53
[5003]54## -------- Run the Greenstone Librarian Interface --------
[19392]55# Need to run this script from its own directory instead of whichever directory it may be called from
56#currentdir=$(cd `dirname "$0"` && pwd)
57thisdir="`dirname \"$0\"`"
58thisdir="`cd \"$thisdir\" && pwd`"
59cd "$thisdir"
[4952]60
[4914]61
[5003]62## ---- Determine GSDLHOME ----
[19403]63# need to source a script in order to inherit the env vars it has set
64# Exit on error code (non-zero)
65exit_status=0
66source ./findgsdl.sh
67exit_status=$?
68if [ "$exit_status" -eq 1 ]; then
69 exit 1;
[4952]70fi
71
[19355]72## ---- find perl ----
[19403]73# no need to source the findperl script since it does not set env vars
[19355]74exit_status=0
75./findperl.sh
76exit_status=$?
77if [ "$exit_status" -eq 1 ]; then
78 exit 1;
[4952]79fi
80
[17493]81## ---- Check Java ----
[19355]82# call the script with source, so that we have the variables it sets ($javapath)
83exit_status=0
[19769]84source ./findjava.sh "$glilang" "$PROGNAME"
[19355]85exit_status=$?
86if [ "$exit_status" -eq 1 ]; then
87 exit 1;
[6702]88fi
[4952]89
[5003]90## ---- Check that the GLI has been compiled ----
[7748]91if [ ! -f "classes/org/greenstone/gatherer/GathererProg.class" ] && [ ! -f "GLI.jar" ]; then
[8901]92 echo
[12286]93 if [ "$glilang" = "es" ]; then
[17493]94 echo "Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone"
95 echo "(por medio de makegli.sh) antes de ejecutar este guión."
[12286]96 elif [ "$glilang" = "fr" ]; then
[17493]97 echo "Vous devez compiler le Greenstone Interface (en utilisant makegli.sh)"
98 echo "avant d'exécuter ce script."
[12286]99 elif [ "$glilang" = "ru" ]; then
[17493]100 echo "÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone"
101 echo "(ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ"
[6702]102 else
[17493]103 echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
104 echo "before running this script."
[6702]105 fi
[4952]106 exit 1
107fi
108
[17672]109## ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ----
110if [ -e "$GSDLHOME/bin/$GSDLOS/ghostscript" ] ; then
111echo "GhostScript bundled with Greenstone will be used, if you wish to use the version installed on your system (if any) please go to $GSDLHOME/bin/$GSDLOS and rename the folder called ghostscript to something else."
112fi
113echo
114echo
115if [ -e "$GSDLHOME/bin/$GSDLOS/imagemagick" ] ; then
116echo "ImageMagick bundled with Greenstone will be used, if you wish to use the version installed on your system (if any) please go to $GSDLHOME/bin/$GSDLOS and rename the folder called imagemagick to something else."
117echo
118echo
119fi
120
121
[5003]122## ---- Finally, run the GLI ----
[12286]123if [ "$glilang" = "es" ]; then
[14977]124 echo "Ejecutando la Interfaz de la $PROGNAME..."
[12286]125elif [ "$glilang" = "fr" ]; then
[14977]126 echo "Exécution de $PROGNAME..."
[12286]127elif [ "$glilang" = "ru" ]; then
[14977]128 echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ $PROGNAME..."
[6702]129else
[14977]130 echo "Running the $PROGNAME..."
[6702]131fi
[4952]132
[15610]133# basic_command is the cmd string common to both Greenstone 3 and Greenstone 2 execution
[19171]134#basic_command="$javapath -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar org.greenstone.gatherer.GathererProg"
[12225]135stop_gli=0
136while [ "$stop_gli" = "0" ] ; do
[15610]137
[17534]138 # Other arguments you can provide to GLI to work around memory limitations, or debug
139 # -Xms<number>M To set minimum memory (by default 32MB)
140 # -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
141 # -verbose:gc To set garbage collection messages
142 # -Xincgc For incremental garbage collection (significantly slows performance)
143 # -Xprof Function call profiling
144 # -Xloggc:<file> Write garbage collection log
[15610]145
146 exit_status=0
147 if [ "$_version" -eq 2 ]; then
[18988]148# GS2 webLib
149 if [ "$PROGABBR" = "FLI" -o ! -f "$GSDLHOME/gs2-server.sh" ]; then
[19171]150 "$javapath" -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl "$GSDLHOME" -gsdlos $GSDLOS $*
[18988]151 exit_status=$?
152# GS2 localLib
153 else
[19171]154 "$javapath" -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl "$GSDLHOME" -gsdlos $GSDLOS -local_library "$GSDLHOME/gs2-server.sh" $*
[18988]155 exit_status=$?
156 fi
157# GS3
[15610]158 elif [ "$_version" -eq 3 ]; then
[19171]159 "$javapath" -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl "$GSDLHOME" -gsdlos $GSDLOS -gsdl3 "$GSDL3HOME" -gsdl3src "$GSDL3SRCHOME" $*
[17534]160 exit_status=$?
[15610]161 fi
162
163 if [ "$exit_status" != "2" ] ; then
[17534]164 stop_gli=1
[12225]165 else
[17534]166 echo
167 if [ "$glilang" = "es" ]; then
168 echo "Restarting/Ejecutando la Interfaz de la $PROGNAME..."
169 elif [ "$glilang" = "fr" ]; then
170 echo "Restarting/Exécution de $PROGNAME..."
171 elif [ "$glilang" = "ru" ]; then
172 echo "Restarting/ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ $PROGNAME..."
173 else
174 echo "Restarting the $PROGNAME..."
175 fi
[12225]176 fi
177done
178
[12286]179if [ "$glilang" = "es" ]; then
[6745]180 echo "¡Hecho!"
[12286]181elif [ "$glilang" = "fr" ]; then
[6712]182 echo "Terminé!"
[12286]183elif [ "$glilang" = "ru" ]; then
[6702]184 echo "÷ÙÐÏÌÎÅÎÏ!"
185else
186 echo "Done!"
[19392]187fi
Note: See TracBrowser for help on using the repository browser.