source: main/trunk/gli/client-gli.sh@ 29222

Last change on this file since 29222 was 24881, checked in by ak19, 12 years ago

Needed to have a bin/bash instead of bin/sh at the top, else Ubuntu does not recognise source (commands that source another script).

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