source: gli/trunk/client-gli.sh@ 19737

Last change on this file since 19737 was 19737, checked in by ak19, 15 years ago

Bugfix in branches that hadn't been executed so far: can't call return on a function that returns a value. Also made glilang a parameter, since findjava.sh is now almost duplicated for the GS2 installation folder as well, which can't be using glilang. Now the variable is called gslang inside the findjava.sh script.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.3 KB
RevLine 
[10759]1#!/bin/sh
2glilang=en
3
[16368]4if [ "x$PROGNAME" = "x" ] ; then
5 PROGNAME="Greenstone"
6 if [ "$glilang" = "es" ]; then
7 PROGFULLNAME="Biblioteca Digital Greenstone"
8 elif [ "$glilang" = "fr" ]; then
9 PROGFULLNAME="Bibliothécaire Greenstone"
10 elif [ "$glilang" = "ru" ]; then
11 PROGFULLNAME="ÉÎÔÅÒÆÅÊÓ Greenstone"
12 else
13 PROGFULLNAME="Greenstone Digital Library"
14 fi
15 else
16 PROGFULLNAME=$PROGNAME
17fi
18
19if [ "x$PROGABBR" = "x" ] ; then
20 PROGABBR="GLI"
21fi
22
23if [ "x$PROGNAME_EN" = "x" ] ; then
24 PROGNAME_EN="Greenstone Librarian Interface"
25fi
26
[19403]27# we're running GLI (or FLI) in client mode
28GLIMODE="client"
[16368]29
[19403]30
[10759]31echo
[12287]32if [ "$glilang" = "es" ]; then
[16368]33 echo "Interfaz de la $PROGFULLNAME ($PROGNAME_EN - $PROGABBR)"
[17946]34 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[16368]35 echo "La Interfaz de la $PROGNAME NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÍA."
[10759]36 echo "Para mayor información vea los términos de la licencia en LICENSE.txt"
37 echo "Este es un software abierto, por lo que lo invitamos a que lo distribuya de forma gratuita"
[12287]38elif [ "$glilang" = "fr" ]; then
[16368]39 echo "Interface du $PROGFULLNAME ($PROGNAME_EN - $PROGABBR)"
[17946]40 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[16368]41 echo "$PROGABBR est fourni sans AUCUNE GARANTIE; pour des détails, voir LICENSE.txt"
[10759]42 echo "Ceci est un logiciel libre, et vous êtes invité à le redistribuer"
[12287]43elif [ "$glilang" = "ru" ]; then
[16368]44 echo "âÉÂÌÉÏÔÅÞÎÙÊ $PROGFULLNAME ($PROGNAME_EN - $PROGABBR)"
[17946]45 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[10759]46 echo "âéç ÎÅ ÄÁÅÔ áâóïìàôîï îéëáëéè çáòáîôéê; ÄÅÔÁÌÉ ÓÍ. × ÔÅËÓÔÅ LICENSE.TXT"
47 echo "üÔÏ - Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ É ÷Ù ÍÏÖÅÔÅ ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÇÏ"
48else
[16368]49 echo "$PROGNAME Librarian Interface ($PROGABBR)"
[17946]50 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[16368]51 echo "$PROGABBR comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
[10759]52 echo "This is free software, and you are welcome to redistribute it"
53fi
54echo
55
56## -------- Run the Greenstone Librarian Interface --------
[19392]57# Need to run this script from its own directory instead of whichever directory it may be called from
58#currentdir=$(cd `dirname "$0"` && pwd)
59thisdir="`dirname \"$0\"`"
60thisdir="`cd \"$thisdir\" && pwd`"
61cd "$thisdir"
[10759]62
[19403]63## ---- Determine GSDLHOME to see if the download panel can be enabled ----
64# Need to source a script in order to inherit the env vars it has set.
65# Try to detect a local GSDLHOME installation (need gs2build). If none can
66# be found, then client-gli won't have a download panel. We're calling
67# findgsdl.bat purely for knowing if there's a GSDLHOME around and to set and
68# use that for downloading. If there IS a local GSDLHOME, then we can download
69# (and build) locally, but ONLY if we have perl. Else downloading and building
70# will have to be done remotely anyway. If Perl is found, PERLPATH will be set.
71source ./findgsdl.sh
72local_gs="false"
73if [ "x$GSDLHOME" != "x" ] ; then
74 # GSDLHOME set, test for perl
75 # no need to source the findperl script since it does not set env vars
76 exit_status=0
77 ./findperl.sh
78 exit_status=$?
79 if [ "$exit_status" -ne 1 ]; then
80 local_gs="true"
81 fi
82fi
83
84
[19355]85## ---- findJava ----
86# call the script with source, so that we have the variables it sets ($javapath)
87exit_status=0
[19737]88source ./findjava.sh $glilang
[19355]89exit_status=$?
90if [ "$exit_status" -eq 1 ]; then
91 exit 1;
[10759]92fi
93
94## ---- Check that the GLI has been compiled ----
95if [ ! -f "classes/org/greenstone/gatherer/GathererProg.class" ] && [ ! -f "GLI.jar" ]; then
96 echo
[12287]97 if [ "$glilang" = "es" ]; then
[16368]98 echo "Usted necesita compilar la Interfaz de la $PROGFULLNAME"
[10759]99 echo "(por medio de makegli.sh) antes de ejecutar este guión."
[12287]100 elif [ "$glilang" = "fr" ]; then
[16368]101 echo "Vous devez compiler le $PROGNAME Interface (en utilisant makegli.sh)"
[10759]102 echo "avant d'exécuter ce script."
[12287]103 elif [ "$glilang" = "ru" ]; then
[16368]104 echo "÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ $PROGNAME"
[10759]105 echo "(ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ"
106 else
[16368]107 echo "You need to compile the $PROGNAME Librarian Interface (using makegli.sh)"
[10759]108 echo "before running this script."
109 fi
110 exit 1
111fi
112
113
114## ---- Finally, run the GLI ----
115echo
[12287]116if [ "$glilang" = "es" ]; then
[16368]117 echo "Ejecutando la Interfaz de la $PROGFULLNAME..."
[12287]118elif [ "$glilang" = "fr" ]; then
[16368]119 echo "Exécution de $PROGNAME Librarian Interface"
[12287]120elif [ "$glilang" = "ru" ]; then
[16368]121 echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ $PROGNAME..."
[10759]122else
[16368]123 echo "Running the $PROGNAME Librarian Interface..."
[10759]124fi
125
126# Other arguments you can provide to GLI to work around memory limitations, or debug
127# -Xms<number>M To set minimum memory (by default 32MB)
128# -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
129# -verbose:gc To set garbage collection messages
130# -Xincgc For incremental garbage collection (significantly slows performance)
131# -Xprof Function call profiling
132# -Xloggc:<file> Write garbage collection log
133
[16368]134# GS2 only requires -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar. GS3 requires more but it doesn't conflict with GS2:
[19403]135if [ "$local_gs" = "false" ]; then
136 echo "Since there's no GSDLHOME, client-GLI's download panel will be deactivated."
137 echo
[19305]138 $javapath -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar:lib/commons-codec-1.3.jar:lib/commons-httpclient-3.1-rc1.jar:lib/commons-logging-1.1.jar org.greenstone.gatherer.GathererProg -use_remote_greenstone $*
139else
[19313]140 gsdlos=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
[19403]141 # check for running bash under cygwin
[19313]142 if test "`echo $gsdlos | sed 's/cygwin//'`" != "$gsdlos" ; then
143 gsdlos=windows
144 fi
[19403]145 echo "Perl and GSDLHOME ($GSDLHOME) detected."
146 echo "Downloading is enabled."
147 echo
148 $javapath -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar:lib/commons-codec-1.3.jar:lib/commons-httpclient-3.1-rc1.jar:lib/commons-logging-1.1.jar org.greenstone.gatherer.GathererProg -use_remote_greenstone -gsdl "$GSDLHOME" -gsdlos $gsdlos $*
[19305]149fi
[10759]150
[12287]151if [ "$glilang" = "es" ]; then
[10759]152 echo "¡Hecho!"
[12287]153elif [ "$glilang" = "fr" ]; then
[10759]154 echo "Terminé!"
[12287]155elif [ "$glilang" = "ru" ]; then
[10759]156 echo "÷ÙÐÏÌÎÅÎÏ!"
157else
158 echo "Done!"
159fi
Note: See TracBrowser for help on using the repository browser.