1 | #!/bin/bash
|
---|
2 |
|
---|
3 | glilang=en
|
---|
4 |
|
---|
5 | if [ "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
|
---|
15 | fi
|
---|
16 |
|
---|
17 | if [ "x$PROGABBR" = "x" ] ; then
|
---|
18 | PROGABBR="GLI"
|
---|
19 | fi
|
---|
20 |
|
---|
21 | if [ "x$PROGNAME_EN" = "x" ] ; then
|
---|
22 | PROGNAME_EN="Greenstone Librarian Interface"
|
---|
23 | fi
|
---|
24 |
|
---|
25 | if [ "x$GLIMODE" = "x" ] ; then
|
---|
26 | GLIMODE="local"
|
---|
27 | fi
|
---|
28 |
|
---|
29 | echo
|
---|
30 | if [ "$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"
|
---|
36 | elif [ "$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"
|
---|
41 | elif [ "$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 "üÔÏ - Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ É ÷Ù ÍÏÖÅÔÅ ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÇÏ"
|
---|
46 | else
|
---|
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"
|
---|
51 | fi
|
---|
52 | echo
|
---|
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)
|
---|
57 | thisdir="`dirname \"$0\"`"
|
---|
58 | thisdir="`cd \"$thisdir\" && pwd`"
|
---|
59 | cd "$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)
|
---|
65 | exit_status=0
|
---|
66 | source ./findgsdl.sh
|
---|
67 | exit_status=$?
|
---|
68 | if [ "$exit_status" -eq 1 ]; then
|
---|
69 | exit 1;
|
---|
70 | fi
|
---|
71 |
|
---|
72 | ## ---- find perl ----
|
---|
73 | # no need to source the findperl script since it does not set env vars
|
---|
74 | exit_status=0
|
---|
75 | ./findperl.sh
|
---|
76 | exit_status=$?
|
---|
77 | if [ "$exit_status" -eq 1 ]; then
|
---|
78 | exit 1;
|
---|
79 | fi
|
---|
80 |
|
---|
81 | ## ---- Check Java ----
|
---|
82 | # call the script with source, so that we have the variables it sets ($javapath)
|
---|
83 | exit_status=0
|
---|
84 | source ./findjava.sh "$glilang" "$PROGNAME"
|
---|
85 | exit_status=$?
|
---|
86 | if [ "$exit_status" -eq 1 ]; then
|
---|
87 | exit 1;
|
---|
88 | fi
|
---|
89 |
|
---|
90 | ## ---- Check that the GLI has been compiled ----
|
---|
91 | if [ ! -f "classes/org/greenstone/gatherer/GathererProg.class" ] && [ ! -f "GLI.jar" ]; then
|
---|
92 | echo
|
---|
93 | if [ "$glilang" = "es" ]; then
|
---|
94 | echo "Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone"
|
---|
95 | echo "(por medio de makegli.sh) antes de ejecutar este guión."
|
---|
96 | elif [ "$glilang" = "fr" ]; then
|
---|
97 | echo "Vous devez compiler le Greenstone Interface (en utilisant makegli.sh)"
|
---|
98 | echo "avant d'exécuter ce script."
|
---|
99 | elif [ "$glilang" = "ru" ]; then
|
---|
100 | echo "÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone"
|
---|
101 | echo "(ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ"
|
---|
102 | else
|
---|
103 | echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
|
---|
104 | echo "before running this script."
|
---|
105 | fi
|
---|
106 | exit 1
|
---|
107 | fi
|
---|
108 |
|
---|
109 | ## ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ----
|
---|
110 | if [ -e "$GSDLHOME/bin/$GSDLOS/ghostscript" ] ; then
|
---|
111 | echo "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."
|
---|
112 | fi
|
---|
113 | echo
|
---|
114 | echo
|
---|
115 | if [ -e "$GSDLHOME/bin/$GSDLOS/imagemagick" ] ; then
|
---|
116 | echo "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."
|
---|
117 | echo
|
---|
118 | echo
|
---|
119 | fi
|
---|
120 |
|
---|
121 |
|
---|
122 | ## ---- Finally, run the GLI ----
|
---|
123 | if [ "$glilang" = "es" ]; then
|
---|
124 | echo "Ejecutando la Interfaz de la $PROGNAME..."
|
---|
125 | elif [ "$glilang" = "fr" ]; then
|
---|
126 | echo "Exécution de $PROGNAME..."
|
---|
127 | elif [ "$glilang" = "ru" ]; then
|
---|
128 | echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ $PROGNAME..."
|
---|
129 | else
|
---|
130 | echo "Running the $PROGNAME..."
|
---|
131 | fi
|
---|
132 |
|
---|
133 | # basic_command is the cmd string common to both Greenstone 3 and Greenstone 2 execution
|
---|
134 | #basic_command="$javapath -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar org.greenstone.gatherer.GathererProg"
|
---|
135 | stop_gli=0
|
---|
136 | while [ "$stop_gli" = "0" ] ; do
|
---|
137 |
|
---|
138 | # Other arguments you can provide to GLI to work around memory limitations, or debug
|
---|
139 | # -Xms<number>M To set minimum memory (by default 32MB)
|
---|
140 | # -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
|
---|
141 | # -verbose:gc To set garbage collection messages
|
---|
142 | # -Xincgc For incremental garbage collection (significantly slows performance)
|
---|
143 | # -Xprof Function call profiling
|
---|
144 | # -Xloggc:<file> Write garbage collection log
|
---|
145 |
|
---|
146 | # -Xdock:name To set the name of the app in the MacOS Dock bar
|
---|
147 | # -Xdock:icon Path to the MacOS Doc icon (not necessary for GS)
|
---|
148 | custom_vm_args=""
|
---|
149 | if [ "$GSDLOS" = "darwin" ]; then
|
---|
150 | custom_vm_args="-Xdock:name=$PROGABBR"
|
---|
151 | if [ -f "../gli.app/Contents/Resources/AutomatorApplet.icns" ]; then
|
---|
152 | custom_vm_args="$custom_vm_args -Xdock:icon=../gli.app/Contents/Resources/AutomatorApplet.icns"
|
---|
153 | fi
|
---|
154 | fi
|
---|
155 |
|
---|
156 | exit_status=0
|
---|
157 | if [ "$_version" -eq 2 ]; then
|
---|
158 | # GS2 webLib
|
---|
159 | if [ "$PROGABBR" = "FLI" -o ! -f "$GSDLHOME/gs2-server.sh" ]; then
|
---|
160 | "$javapath" -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar $custom_vm_args org.greenstone.gatherer.GathererProg -gsdl "$GSDLHOME" -gsdlos $GSDLOS $*
|
---|
161 | exit_status=$?
|
---|
162 | # GS2 localLib
|
---|
163 | else
|
---|
164 | "$javapath" -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar $custom_vm_args org.greenstone.gatherer.GathererProg -gsdl "$GSDLHOME" -gsdlos $GSDLOS -local_library "$GSDLHOME/gs2-server.sh" $*
|
---|
165 | exit_status=$?
|
---|
166 | fi
|
---|
167 | # GS3
|
---|
168 | elif [ "$_version" -eq 3 ]; then
|
---|
169 | "$javapath" -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar:lib/rsyntaxtextarea.jar $custom_vm_args org.greenstone.gatherer.GathererProg -gsdl "$GSDLHOME" -gsdlos $GSDLOS -gsdl3 "$GSDL3HOME" -gsdl3src "$GSDL3SRCHOME" $*
|
---|
170 | exit_status=$?
|
---|
171 | fi
|
---|
172 |
|
---|
173 | if [ "$exit_status" != "2" ] ; then
|
---|
174 | stop_gli=1
|
---|
175 | else
|
---|
176 | echo
|
---|
177 | if [ "$glilang" = "es" ]; then
|
---|
178 | echo "Restarting/Ejecutando la Interfaz de la $PROGNAME..."
|
---|
179 | elif [ "$glilang" = "fr" ]; then
|
---|
180 | echo "Restarting/Exécution de $PROGNAME..."
|
---|
181 | elif [ "$glilang" = "ru" ]; then
|
---|
182 | echo "Restarting/ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ $PROGNAME..."
|
---|
183 | else
|
---|
184 | echo "Restarting the $PROGNAME..."
|
---|
185 | fi
|
---|
186 | fi
|
---|
187 | done
|
---|
188 |
|
---|
189 | if [ "$glilang" = "es" ]; then
|
---|
190 | echo "Hecho."
|
---|
191 | elif [ "$glilang" = "fr" ]; then
|
---|
192 | echo "Terminé."
|
---|
193 | elif [ "$glilang" = "ru" ]; then
|
---|
194 | echo "÷ÙÐÏÌÎÅÎÏ."
|
---|
195 | else
|
---|
196 | echo "Done."
|
---|
197 | fi |
---|