[18634] | 1 | #!/bin/bash
|
---|
[15610] | 2 |
|
---|
[6752] | 3 | glilang=en
|
---|
[13251] | 4 |
|
---|
[14977] | 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 |
|
---|
[19403] | 25 | if [ "x$GLIMODE" = "x" ] ; then
|
---|
| 26 | GLIMODE="local"
|
---|
| 27 | fi
|
---|
| 28 |
|
---|
[6262] | 29 | echo
|
---|
[12286] | 30 | if [ "$glilang" = "es" ]; then
|
---|
[14977] | 31 | echo "Interfaz de la $PROGNAME ($PROGNAME_EN - $PROGABBR)"
|
---|
[12453] | 32 | echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
|
---|
[14977] | 33 | echo "La Interfaz de la $PROGNAME NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÍA."
|
---|
[6959] | 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"
|
---|
[12286] | 36 | elif [ "$glilang" = "fr" ]; then
|
---|
[14977] | 37 | echo "Interface du $PROGNAME ($PROGNAME_EN - $PROGABBR)"
|
---|
[12453] | 38 | echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
|
---|
[14977] | 39 | echo "$PROGABBR est fourni sans AUCUNE GARANTIE; pour des détails, voir LICENSE.txt"
|
---|
[6955] | 40 | echo "Ceci est un logiciel libre, et vous êtes invité à le redistribuer"
|
---|
[12286] | 41 | elif [ "$glilang" = "ru" ]; then
|
---|
[14977] | 42 | echo "âÉÂÌÉÏÔÅÞÎÙÊ $PROGNAME ($PROGNAME_EN - $PROGABBR)"
|
---|
[12453] | 43 | echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
|
---|
[7041] | 44 | echo "âéç ÎÅ ÄÁÅÔ áâóïìàôîï îéëáëéè çáòáîôéê; ÄÅÔÁÌÉ ÓÍ. × ÔÅËÓÔÅ LICENSE.TXT"
|
---|
| 45 | echo "üÔÏ - Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ É ÷Ù ÍÏÖÅÔÅ ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÇÏ"
|
---|
[6702] | 46 | else
|
---|
[14977] | 47 | echo "$PROGNAME ($PROGABBR)"
|
---|
[12453] | 48 | echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
|
---|
[14977] | 49 | echo "$PROGABBR comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt"
|
---|
[6955] | 50 | echo "This is free software, and you are welcome to redistribute it"
|
---|
[6702] | 51 | fi
|
---|
[6223] | 52 | echo
|
---|
[4952] | 53 |
|
---|
[5003] | 54 | ## -------- Run the Greenstone Librarian Interface --------
|
---|
[19392] | 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"
|
---|
[4952] | 60 |
|
---|
[4914] | 61 |
|
---|
[5003] | 62 | ## ---- Determine GSDLHOME ----
|
---|
[19403] | 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;
|
---|
[4952] | 70 | fi
|
---|
| 71 |
|
---|
[19355] | 72 | ## ---- find perl ----
|
---|
[19403] | 73 | # no need to source the findperl script since it does not set env vars
|
---|
[19355] | 74 | exit_status=0
|
---|
| 75 | ./findperl.sh
|
---|
| 76 | exit_status=$?
|
---|
| 77 | if [ "$exit_status" -eq 1 ]; then
|
---|
| 78 | exit 1;
|
---|
[4952] | 79 | fi
|
---|
| 80 |
|
---|
[17493] | 81 | ## ---- Check Java ----
|
---|
[19355] | 82 | # call the script with source, so that we have the variables it sets ($javapath)
|
---|
| 83 | exit_status=0
|
---|
[19769] | 84 | source ./findjava.sh "$glilang" "$PROGNAME"
|
---|
[19355] | 85 | exit_status=$?
|
---|
| 86 | if [ "$exit_status" -eq 1 ]; then
|
---|
| 87 | exit 1;
|
---|
[6702] | 88 | fi
|
---|
[31970] | 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
|
---|
[4952] | 99 |
|
---|
[31970] | 100 |
|
---|
[5003] | 101 | ## ---- Check that the GLI has been compiled ----
|
---|
[7748] | 102 | if [ ! -f "classes/org/greenstone/gatherer/GathererProg.class" ] && [ ! -f "GLI.jar" ]; then
|
---|
[8901] | 103 | echo
|
---|
[12286] | 104 | if [ "$glilang" = "es" ]; then
|
---|
[17493] | 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."
|
---|
[12286] | 107 | elif [ "$glilang" = "fr" ]; then
|
---|
[17493] | 108 | echo "Vous devez compiler le Greenstone Interface (en utilisant makegli.sh)"
|
---|
| 109 | echo "avant d'exécuter ce script."
|
---|
[12286] | 110 | elif [ "$glilang" = "ru" ]; then
|
---|
[17493] | 111 | echo "÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone"
|
---|
| 112 | echo "(ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ"
|
---|
[6702] | 113 | else
|
---|
[17493] | 114 | echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
|
---|
| 115 | echo "before running this script."
|
---|
[6702] | 116 | fi
|
---|
[4952] | 117 | exit 1
|
---|
| 118 | fi
|
---|
| 119 |
|
---|
[17672] | 120 | ## ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ----
|
---|
| 121 | if [ -e "$GSDLHOME/bin/$GSDLOS/ghostscript" ] ; then
|
---|
| 122 | 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."
|
---|
| 123 | fi
|
---|
| 124 | echo
|
---|
| 125 | echo
|
---|
| 126 | if [ -e "$GSDLHOME/bin/$GSDLOS/imagemagick" ] ; then
|
---|
| 127 | 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."
|
---|
| 128 | echo
|
---|
| 129 | echo
|
---|
| 130 | fi
|
---|
| 131 |
|
---|
| 132 |
|
---|
[5003] | 133 | ## ---- Finally, run the GLI ----
|
---|
[12286] | 134 | if [ "$glilang" = "es" ]; then
|
---|
[14977] | 135 | echo "Ejecutando la Interfaz de la $PROGNAME..."
|
---|
[12286] | 136 | elif [ "$glilang" = "fr" ]; then
|
---|
[14977] | 137 | echo "Exécution de $PROGNAME..."
|
---|
[12286] | 138 | elif [ "$glilang" = "ru" ]; then
|
---|
[14977] | 139 | echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ $PROGNAME..."
|
---|
[6702] | 140 | else
|
---|
[14977] | 141 | echo "Running the $PROGNAME..."
|
---|
[6702] | 142 | fi
|
---|
[4952] | 143 |
|
---|
[15610] | 144 | # basic_command is the cmd string common to both Greenstone 3 and Greenstone 2 execution
|
---|
[31649] | 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"
|
---|
[12225] | 146 | stop_gli=0
|
---|
| 147 | while [ "$stop_gli" = "0" ] ; do
|
---|
[15610] | 148 |
|
---|
[17534] | 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
|
---|
[23590] | 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"
|
---|
[30119] | 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
|
---|
[23590] | 165 | fi
|
---|
[15610] | 166 |
|
---|
| 167 | exit_status=0
|
---|
| 168 | if [ "$_version" -eq 2 ]; then
|
---|
[18988] | 169 | # GS2 webLib
|
---|
| 170 | if [ "$PROGABBR" = "FLI" -o ! -f "$GSDLHOME/gs2-server.sh" ]; then
|
---|
[31649] | 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 $*
|
---|
[18988] | 172 | exit_status=$?
|
---|
| 173 | # GS2 localLib
|
---|
| 174 | else
|
---|
[31649] | 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" $*
|
---|
[18988] | 176 | exit_status=$?
|
---|
| 177 | fi
|
---|
| 178 | # GS3
|
---|
[15610] | 179 | elif [ "$_version" -eq 3 ]; then
|
---|
[31649] | 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" $*
|
---|
[17534] | 181 | exit_status=$?
|
---|
[15610] | 182 | fi
|
---|
| 183 |
|
---|
| 184 | if [ "$exit_status" != "2" ] ; then
|
---|
[17534] | 185 | stop_gli=1
|
---|
[12225] | 186 | else
|
---|
[17534] | 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
|
---|
[12225] | 197 | fi
|
---|
| 198 | done
|
---|
| 199 |
|
---|
[12286] | 200 | if [ "$glilang" = "es" ]; then
|
---|
[22409] | 201 | echo "Hecho."
|
---|
[12286] | 202 | elif [ "$glilang" = "fr" ]; then
|
---|
[22409] | 203 | echo "Terminé."
|
---|
[12286] | 204 | elif [ "$glilang" = "ru" ]; then
|
---|
[22409] | 205 | echo "÷ÙÐÏÌÎÅÎÏ."
|
---|
[6702] | 206 | else
|
---|
[22409] | 207 | echo "Done."
|
---|
[19392] | 208 | fi |
---|