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

Last change on this file since 34259 was 34259, checked in by ak19, 4 years ago

Related to commit 34258. Equivalent changes for linux/mac: when running a standalone client-gli installation, if there's a packages/OS/jre (as for running GS3/GLI, this JRE may not get used on Mac as this comes preinstalled with Java) and if there's a bin/OS/search4j, client-gli.sh and findjava.sh will now use the path to a jre inside the standalone client-gli as hint for a bundled search4j to locate an appropriate java.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 7.4 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
86else
87 export GLIHOME=`pwd`
88 echo "@@@ Standalone client-gli, GLIHOME: $GLIHOME"
89 # GSDLOS would not have been set yet
90 if test "x$GSDLOS" = "x" ; then
91 GSDLOS=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
92 # check for running bash under cygwin
93 if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ; then
94 GSDLOS=windows
95 fi
96 fi
97 export GSDLOS
98fi
99
100
101## ---- findJava ----
102# call the script with source, so that we have the variables it sets ($javapath)
103exit_status=0
104source ./findjava.sh "$glilang" "$PROGABBR"
105exit_status=$?
106if [ "$exit_status" -eq 1 ]; then
107 exit 1;
108fi
109
110## ---- Check that the GLI has been compiled ----
111if [ ! -f "classes/org/greenstone/gatherer/GathererProg.class" ] && [ ! -f "GLI.jar" ]; then
112 echo
113 if [ "$glilang" = "es" ]; then
114 echo "Usted necesita compilar la Interfaz de la $PROGFULLNAME"
115 echo "(por medio de makegli.sh) antes de ejecutar este guión."
116 elif [ "$glilang" = "fr" ]; then
117 echo "Vous devez compiler le $PROGNAME Interface (en utilisant makegli.sh)"
118 echo "avant d'exécuter ce script."
119 elif [ "$glilang" = "ru" ]; then
120 echo "÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ $PROGNAME"
121 echo "(ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ"
122 else
123 echo "You need to compile the $PROGNAME Librarian Interface (using makegli.sh)"
124 echo "before running this script."
125 fi
126 exit 1
127fi
128
129
130## ---- Finally, run the GLI ----
131echo
132if [ "$glilang" = "es" ]; then
133 echo "Ejecutando la Interfaz de la $PROGFULLNAME..."
134elif [ "$glilang" = "fr" ]; then
135 echo "Exécution de $PROGNAME Librarian Interface"
136elif [ "$glilang" = "ru" ]; then
137 echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ $PROGNAME..."
138else
139 echo "Running the $PROGNAME Librarian Interface..."
140fi
141
142# Other arguments you can provide to GLI to work around memory limitations, or debug
143# -Xms<number>M To set minimum memory (by default 32MB)
144# -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
145# -verbose:gc To set garbage collection messages
146# -Xincgc For incremental garbage collection (significantly slows performance)
147# -Xprof Function call profiling
148# -Xloggc:<file> Write garbage collection log
149
150# -Xdock:name To set the name of the app in the MacOS Dock bar
151# -Xdock:icon Path to the MacOS Doc icon (not necessary for GS)
152custom_vm_args=""
153if [ "$GSDLOS" = "darwin" ]; then
154 custom_vm_args="-Xdock:name=$PROGABBR"
155 if [ -f "../client-gli.app/Contents/Resources/AutomatorApplet.icns" ]; then
156 custom_vm_args="$custom_vm_args -Xdock:icon=../client-gli.app/Contents/Resources/AutomatorApplet.icns"
157 fi
158fi
159
160# GS2 only requires -classpath classes/:GLI.jar:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar. GS3 requires more but it doesn't conflict with GS2:
161if [ "$local_gs" = "false" ]; then
162 echo "Since there's no GSDLHOME, client-GLI's download panel will be deactivated."
163 echo
164 $javapath -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.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 $*
165else
166 gsdlos=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
167 # check for running bash under cygwin
168 if test "`echo $gsdlos | sed 's/cygwin//'`" != "$gsdlos" ; then
169 gsdlos=windows
170 fi
171 echo "Perl and GSDLHOME ($GSDLHOME) detected."
172 echo "Downloading is enabled."
173 echo
174 $javapath -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.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 $*
175fi
176
177if [ "$glilang" = "es" ]; then
178 echo "¡Hecho!"
179elif [ "$glilang" = "fr" ]; then
180 echo "Terminé!"
181elif [ "$glilang" = "ru" ]; then
182 echo "÷ÙÐÏÌÎÅÎÏ!"
183else
184 echo "Done!"
185fi
Note: See TracBrowser for help on using the repository browser.