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

Last change on this file since 24881 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
RevLine 
[24881]1#!/bin/bash
[10759]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
[23590]18export PROGNAME
19export PROGFULLNAME
[16368]20
21if [ "x$PROGABBR" = "x" ] ; then
[23590]22 PROGABBR="Client-GLI"
[16368]23fi
[23590]24export PROGABBR
[16368]25
26if [ "x$PROGNAME_EN" = "x" ] ; then
[23590]27 PROGNAME_EN="Greenstone Librarian Interface - Remote Client"
[16368]28fi
[23590]29export PROGNAME_EN
[16368]30
[19403]31# we're running GLI (or FLI) in client mode
32GLIMODE="client"
[16368]33
[19403]34
[10759]35echo
[12287]36if [ "$glilang" = "es" ]; then
[16368]37 echo "Interfaz de la $PROGFULLNAME ($PROGNAME_EN - $PROGABBR)"
[17946]38 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[16368]39 echo "La Interfaz de la $PROGNAME NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÍA."
[10759]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"
[12287]42elif [ "$glilang" = "fr" ]; then
[16368]43 echo "Interface du $PROGFULLNAME ($PROGNAME_EN - $PROGABBR)"
[17946]44 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[16368]45 echo "$PROGABBR est fourni sans AUCUNE GARANTIE; pour des détails, voir LICENSE.txt"
[10759]46 echo "Ceci est un logiciel libre, et vous êtes invité à le redistribuer"
[12287]47elif [ "$glilang" = "ru" ]; then
[16368]48 echo "âÉÂÌÉÏÔÅÞÎÙÊ $PROGFULLNAME ($PROGNAME_EN - $PROGABBR)"
[17946]49 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[10759]50 echo "âéç ÎÅ ÄÁÅÔ áâóïìàôîï îéëáëéè çáòáîôéê; ÄÅÔÁÌÉ ÓÍ. × ÔÅËÓÔÅ LICENSE.TXT"
51 echo "üÔÏ - Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ É ÷Ù ÍÏÖÅÔÅ ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÇÏ"
52else
[16368]53 echo "$PROGNAME Librarian Interface ($PROGABBR)"
[17946]54 echo "Copyright (C) 2008, New Zealand Digital Library Project, University Of Waikato"
[16368]55 echo "$PROGABBR comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
[10759]56 echo "This is free software, and you are welcome to redistribute it"
57fi
58echo
59
60## -------- Run the Greenstone Librarian Interface --------
[19392]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"
[10759]66
[19403]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
[19355]89## ---- findJava ----
90# call the script with source, so that we have the variables it sets ($javapath)
91exit_status=0
[19769]92source ./findjava.sh "$glilang" "$PROGABBR"
[19355]93exit_status=$?
94if [ "$exit_status" -eq 1 ]; then
95 exit 1;
[10759]96fi
97
98## ---- Check that the GLI has been compiled ----
99if [ ! -f "classes/org/greenstone/gatherer/GathererProg.class" ] && [ ! -f "GLI.jar" ]; then
100 echo
[12287]101 if [ "$glilang" = "es" ]; then
[16368]102 echo "Usted necesita compilar la Interfaz de la $PROGFULLNAME"
[10759]103 echo "(por medio de makegli.sh) antes de ejecutar este guión."
[12287]104 elif [ "$glilang" = "fr" ]; then
[16368]105 echo "Vous devez compiler le $PROGNAME Interface (en utilisant makegli.sh)"
[10759]106 echo "avant d'exécuter ce script."
[12287]107 elif [ "$glilang" = "ru" ]; then
[16368]108 echo "÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ $PROGNAME"
[10759]109 echo "(ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ"
110 else
[16368]111 echo "You need to compile the $PROGNAME Librarian Interface (using makegli.sh)"
[10759]112 echo "before running this script."
113 fi
114 exit 1
115fi
116
117
118## ---- Finally, run the GLI ----
119echo
[12287]120if [ "$glilang" = "es" ]; then
[16368]121 echo "Ejecutando la Interfaz de la $PROGFULLNAME..."
[12287]122elif [ "$glilang" = "fr" ]; then
[16368]123 echo "Exécution de $PROGNAME Librarian Interface"
[12287]124elif [ "$glilang" = "ru" ]; then
[16368]125 echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ $PROGNAME..."
[10759]126else
[16368]127 echo "Running the $PROGNAME Librarian Interface..."
[10759]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
[23590]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
[16368]145# GS2 only requires -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar. GS3 requires more but it doesn't conflict with GS2:
[19403]146if [ "$local_gs" = "false" ]; then
147 echo "Since there's no GSDLHOME, client-GLI's download panel will be deactivated."
148 echo
[23590]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 $*
[19305]150else
[19313]151 gsdlos=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
[19403]152 # check for running bash under cygwin
[19313]153 if test "`echo $gsdlos | sed 's/cygwin//'`" != "$gsdlos" ; then
154 gsdlos=windows
155 fi
[19403]156 echo "Perl and GSDLHOME ($GSDLHOME) detected."
157 echo "Downloading is enabled."
158 echo
[23590]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 $*
[19305]160fi
[10759]161
[12287]162if [ "$glilang" = "es" ]; then
[10759]163 echo "¡Hecho!"
[12287]164elif [ "$glilang" = "fr" ]; then
[10759]165 echo "Terminé!"
[12287]166elif [ "$glilang" = "ru" ]; then
[10759]167 echo "÷ÙÐÏÌÎÅÎÏ!"
168else
169 echo "Done!"
170fi
Note: See TracBrowser for help on using the repository browser.