source: main/trunk/gli/gli.sh@ 32003

Last change on this file since 32003 was 31970, checked in by ak19, 7 years ago

Unused, but possibly useful, commented out code

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 8.0 KB
Line 
1#!/bin/bash
2
3glilang=en
4
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
25if [ "x$GLIMODE" = "x" ] ; then
26 GLIMODE="local"
27fi
28
29echo
30if [ "$glilang" = "es" ]; then
31 echo "Interfaz de la $PROGNAME ($PROGNAME_EN - $PROGABBR)"
32 echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
33 echo "La Interfaz de la $PROGNAME NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÍA."
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"
36elif [ "$glilang" = "fr" ]; then
37 echo "Interface du $PROGNAME ($PROGNAME_EN - $PROGABBR)"
38 echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
39 echo "$PROGABBR est fourni sans AUCUNE GARANTIE; pour des détails, voir LICENSE.txt"
40 echo "Ceci est un logiciel libre, et vous êtes invité à le redistribuer"
41elif [ "$glilang" = "ru" ]; then
42 echo "âÉÂÌÉÏÔÅÞÎÙÊ $PROGNAME ($PROGNAME_EN - $PROGABBR)"
43 echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
44 echo "âéç ÎÅ ÄÁÅÔ áâóïìàôîï îéëáëéè çáòáîôéê; ÄÅÔÁÌÉ ÓÍ. × ÔÅËÓÔÅ LICENSE.TXT"
45 echo "üÔÏ - Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ É ÷Ù ÍÏÖÅÔÅ ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÇÏ"
46else
47 echo "$PROGNAME ($PROGABBR)"
48 echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
49 echo "$PROGABBR comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
50 echo "This is free software, and you are welcome to redistribute it"
51fi
52echo
53
54## -------- Run the Greenstone Librarian Interface --------
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"
60
61
62## ---- Determine GSDLHOME ----
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;
70fi
71
72## ---- find perl ----
73# no need to source the findperl script since it does not set env vars
74exit_status=0
75./findperl.sh
76exit_status=$?
77if [ "$exit_status" -eq 1 ]; then
78 exit 1;
79fi
80
81## ---- Check Java ----
82# call the script with source, so that we have the variables it sets ($javapath)
83exit_status=0
84source ./findjava.sh "$glilang" "$PROGNAME"
85exit_status=$?
86if [ "$exit_status" -eq 1 ]; then
87 exit 1;
88fi
89## if we're using a bundled java in GS2, then put the bundled java into the environment too (don't just use it to launch GLI)
90#if [[ $javapath == *"/packages/jre"* ]]; then
91# if [ "$_version" -eq 2 ]; then
92# export JRE_HOME=$GSDLHOME/packages/jre
93## Shouldn't be necessary to set JAVA_HOME to JRE_HOME. If only JRE_HOME exists, it should suffice for GLI:
94# ##export JAVA_HOME=$JRE_HOME
95# echo "@@@ SETTING JAVA ENV TO THE BUNDLED JRE: JRE_HOME: $JRE_HOME"
96# export PATH=$JRE_HOME/bin:$PATH
97# fi
98#fi
99
100
101## ---- Check that the GLI has been compiled ----
102if [ ! -f "classes/org/greenstone/gatherer/GathererProg.class" ] && [ ! -f "GLI.jar" ]; then
103 echo
104 if [ "$glilang" = "es" ]; then
105 echo "Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone"
106 echo "(por medio de makegli.sh) antes de ejecutar este guión."
107 elif [ "$glilang" = "fr" ]; then
108 echo "Vous devez compiler le Greenstone Interface (en utilisant makegli.sh)"
109 echo "avant d'exécuter ce script."
110 elif [ "$glilang" = "ru" ]; then
111 echo "÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone"
112 echo "(ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ"
113 else
114 echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
115 echo "before running this script."
116 fi
117 exit 1
118fi
119
120## ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ----
121if [ -e "$GSDLHOME/bin/$GSDLOS/ghostscript" ] ; then
122echo "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."
123fi
124echo
125echo
126if [ -e "$GSDLHOME/bin/$GSDLOS/imagemagick" ] ; then
127echo "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."
128echo
129echo
130fi
131
132
133## ---- Finally, run the GLI ----
134if [ "$glilang" = "es" ]; then
135 echo "Ejecutando la Interfaz de la $PROGNAME..."
136elif [ "$glilang" = "fr" ]; then
137 echo "Exécution de $PROGNAME..."
138elif [ "$glilang" = "ru" ]; then
139 echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ $PROGNAME..."
140else
141 echo "Running the $PROGNAME..."
142fi
143
144# basic_command is the cmd string common to both Greenstone 3 and Greenstone 2 execution
145#basic_command="$javapath -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar org.greenstone.gatherer.GathererProg"
146stop_gli=0
147while [ "$stop_gli" = "0" ] ; do
148
149 # Other arguments you can provide to GLI to work around memory limitations, or debug
150 # -Xms<number>M To set minimum memory (by default 32MB)
151 # -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
152 # -verbose:gc To set garbage collection messages
153 # -Xincgc For incremental garbage collection (significantly slows performance)
154 # -Xprof Function call profiling
155 # -Xloggc:<file> Write garbage collection log
156
157 # -Xdock:name To set the name of the app in the MacOS Dock bar
158 # -Xdock:icon Path to the MacOS Doc icon (not necessary for GS)
159 custom_vm_args=""
160 if [ "$GSDLOS" = "darwin" ]; then
161 custom_vm_args="-Xdock:name=$PROGABBR"
162 if [ -f "../gli.app/Contents/Resources/AutomatorApplet.icns" ]; then
163 custom_vm_args="$custom_vm_args -Xdock:icon=../gli.app/Contents/Resources/AutomatorApplet.icns"
164 fi
165 fi
166
167 exit_status=0
168 if [ "$_version" -eq 2 ]; then
169# GS2 webLib
170 if [ "$PROGABBR" = "FLI" -o ! -f "$GSDLHOME/gs2-server.sh" ]; then
171 "$javapath" -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar $custom_vm_args org.greenstone.gatherer.GathererProg -gsdl "$GSDLHOME" -gsdlos $GSDLOS $*
172 exit_status=$?
173# GS2 localLib
174 else
175 "$javapath" -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar $custom_vm_args org.greenstone.gatherer.GathererProg -gsdl "$GSDLHOME" -gsdlos $GSDLOS -local_library "$GSDLHOME/gs2-server.sh" $*
176 exit_status=$?
177 fi
178# GS3
179 elif [ "$_version" -eq 3 ]; then
180 "$javapath" -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/jna.jar:lib/jna-platform.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar $custom_vm_args org.greenstone.gatherer.GathererProg -gsdl "$GSDLHOME" -gsdlos $GSDLOS -gsdl3 "$GSDL3HOME" -gsdl3src "$GSDL3SRCHOME" $*
181 exit_status=$?
182 fi
183
184 if [ "$exit_status" != "2" ] ; then
185 stop_gli=1
186 else
187 echo
188 if [ "$glilang" = "es" ]; then
189 echo "Restarting/Ejecutando la Interfaz de la $PROGNAME..."
190 elif [ "$glilang" = "fr" ]; then
191 echo "Restarting/Exécution de $PROGNAME..."
192 elif [ "$glilang" = "ru" ]; then
193 echo "Restarting/ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ $PROGNAME..."
194 else
195 echo "Restarting the $PROGNAME..."
196 fi
197 fi
198done
199
200if [ "$glilang" = "es" ]; then
201 echo "Hecho."
202elif [ "$glilang" = "fr" ]; then
203 echo "Terminé."
204elif [ "$glilang" = "ru" ]; then
205 echo "÷ÙÐÏÌÎÅÎÏ."
206else
207 echo "Done."
208fi
Note: See TracBrowser for help on using the repository browser.