root/main/trunk/gli/gli.bat @ 23650

Revision 23650, 7.4 KB (checked in by ak19, 9 years ago)

Fixes to get OpenOffice? plugin's options to show up in GLI without calling GS2's setup.bat manually (it should be called by gli.bat). It wasn't getting called anymore because of the newly added setup.bat file in the openoffice extension, whose subtle interactions with the rest of the gli.bat procedure caused the call to GS2's setup.bat to be skipped.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1@echo off
2color 0A
3set startdir=%CD%
4rem pushd "%CD%"
5CD /D "%~dp0"
6set GLILANG=en
7
8if "%GLIMODE%" == "" set GLIMODE=local
9
10::  -------- Run the Greenstone Librarian Interface --------
11
12:: This script must be run from within the directory in which it lives
13if exist gli.bat goto start
14    if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
15    if "%GLILANG%" == "es" echo Este gui¢n deber  ejecutarse desde el directorio en el que reside.
16    if "%GLILANG%" == "fr" echo Ce script doit ˆtre ex‚cut‚ … partir du r‚pertoire dans lequel il se trouve.
17    if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥­ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ®­ à á¯®«®Š¥­
18    goto exit
19   
20:start
21if "%OS%" == "Windows_NT" goto progName
22    :: Invoke a new command processor to ensure there's enough environment space
23    if "%1" == "Second" goto progName
24        command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
25        shift
26        goto done
27
28:progName
29if not "%PROGNAME%" == "" goto findGSDL
30    :: otherwise PROGNAME was not set, so default to the Greenstone Librarian Interface (GLI) program
31    if "%GLILANG%" == "es" set PROGNAME=Biblioteca Digital Greenstone
32    if "%GLILANG%" == "fr" set PROGNAME=Bibliothécaire Greenstone
33    if "%GLILANG%" == "ru" set PROGNAME=ÉÎÔÅÒÆÅÊÓ Greenstone
34    :: if the PROGNAME is still not set, then set the language to English
35    if "%PROGNAME%" == "" set PROGNAME=Greenstone Librarian Interface
36
37
38if "%PROGABBR%" == "" set PROGABBR=GLI
39if "%PROGNAME_EN%" == "" set PROGNAME_EN=Greenstone Librarian Interface
40
41:: Now need to work out the _VERSION, GSDLHOME (and if GS3, then GSDL3SRCHOME and GSDL3HOME)
42:findGSDL
43call findgsdl.bat
44if "%GSDLHOME%" == "" goto exit
45
46:checkUserPermissions
47    echo.
48    echo Checking if the Greenstone collection directory is writable ...
49    (echo This is a temporary file. It is safe to delete it. > "%GSDLHOME%\collect\testing.tmp" ) 2>nul
50    if exist "%GSDLHOME%\collect\testing.tmp" goto deleteTempFile
51    if "%1" == "Elevated" goto printWarning
52    echo ... FAILED
53    echo The %PROGNAME% cannot write to the collection directory (%GSDLHOME%\collect)
54    echo Requesting elevated status to become admin user to continue.
55    "%GSDLHOME%\bin\windows\gstart.exe" %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9
56    goto done
57   
58:printWarning
59    echo ... FAILED
60    echo The %PROGNAME% cannot write to the log directory (%GSDLHOME%\collect).
61    echo Attempting to continue without permissions.
62    goto shiftElevated
63
64:deleteTempFile
65    echo ... OK
66    del "%GSDLHOME%\collect\testing.tmp"
67
68:shiftElevated
69:: Shift "Elevated" (one of our own internal command words) out of the way if present
70:: so the command-line is as it was when the user initiated the command
71    if "%1" == "Elevated" shift
72
73:: Make sure we're in the GLI folder, even if located outside a GS installation
74CD /D "%~dp0"
75
76:findPerl
77:: Now need to find Perl. If found, PERLPATH will be set
78call findperl.bat
79if "%PERLPATH%" == "" goto exit
80
81:: Need to find Java. If found, JAVA_EXECUTABLE will be set
82call findjava.bat
83if "%JAVA_EXECUTABLE%" == "" goto exit
84
85
86:checkGLI
87:: ---- Check that the GLI has been compiled ----
88if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
89if exist "GLI.jar" goto runGLI
90    echo.
91    if "%GLILANG%" == "en" echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
92    if "%GLILANG%" == "en" echo before running this script.
93
94    if "%GLILANG%" == "es" echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone
95    if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este gui¢n.
96
97    if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
98    if "%GLILANG%" == "fr" echo avant d'ex‚cuter ce script.
99
100    if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
101    if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
102    goto exit
103
104
105:runGLI
106
107if not "%_VERSION%" == "" (
108  echo Greenstone Major Version :
109  echo %_VERSION%
110    echo.
111)
112
113if not "%GSDL3SRCHOME%" == "" (
114    echo GSDL3SRCHOME:
115    echo %GSDL3SRCHOME%
116    echo.
117)
118
119if not "%GSDL3HOME%" == "" (
120    echo GSDL3HOME:
121    echo %GSDL3HOME%
122    echo.
123)
124
125if not "%GSDLHOME%" == "" (
126    echo GSDLHOME:
127    echo %GSDLHOME%
128    echo.
129)
130
131:: ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ----
132echo.
133if exist "%GSDLHOME%\bin\windows\ghostscript\bin\*.*" 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\windows and rename the folder called ghostscript to something else.
134echo.
135echo.
136if exist "%GSDLHOME%\bin\windows\imagemagick\*.*" 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\windows and rename the folder called imagemagick to something else.
137echo.
138echo.
139
140
141:: ---- Finally, run the GLI ----
142if "%GLILANG%" == "en" echo Running the %PROGNAME%...
143if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
144if "%GLILANG%" == "fr" echo Ex‚cution de %PROGNAME%
145if "%GLILANG%" == "ru" echo ’¥ªãéš© ¡š¡«š %PROGNAME%...
146
147:: -Xms32M          To set minimum memory
148:: -Xmx32M          To set maximum memory
149:: -verbose:gc      To set garbage collection messages
150:: -Xincgc          For incremental garbage collection
151:: -Xprof           Function call profiling
152:: -Xloggc:<file>   Write garbage collection log
153
154
155:: Run GS3 if version = 3
156if "%_VERSION%" == "3" "%JAVA_EXECUTABLE%" -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl "%GSDLHOME%" -gsdlos %GSDLOS% -gsdl3 "%GSDL3HOME%" -gsdl3src "%GSDL3SRCHOME%" -perl "%PERLPATH%" %1 %2 %3 %4 %5 %6 %7 %8 %9
157if "%_VERSION%" == "3" goto finRun
158
159:: Run GS2 since version is 2:
160:: if FLI is running, we don't want the local Greenstone library server running
161if "%PROGABBR%" == "FLI" goto webLib
162    :: Else we're running GLI, so we want the local Greenstone library server (if server.exe/gs2-web-server.bat exists, otherwise it will be webLib)
163    if not exist "%GSDLHOME%\server.exe" if not exist "%GSDLHOME%\gs2-web-server.bat" goto webLib
164
165:localLib
166    if exist "%GSDLHOME%\server.exe" (
167    set locallib=%GSDLHOME%\server.exe
168    ) else (
169    set locallib=%GSDLHOME%\gs2-web-server.bat
170    )
171
172    "%JAVA_EXECUTABLE%" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl "%GSDLHOME%" -gsdlos %GSDLOS% -perl "%PERLPATH%" -local_library "%locallib%" %1 %2 %3 %4 %5 %6 %7 %8 %9
173    if ERRORLEVEL 2 (
174        goto localLib
175    )
176    goto finRun
177
178:webLib
179    "%JAVA_EXECUTABLE%" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl "%GSDLHOME%" -gsdlos %GSDLOS% -perl "%PERLPATH%" %1 %2 %3 %4 %5 %6 %7 %8 %9
180    if ERRORLEVEL 2 (
181        goto webLib
182    )
183    goto finRun
184
185:finRun
186    if "%GLILANG%" == "en" echo Done.
187    if "%GLILANG%" == "es" echo Hecho.
188    if "%GLILANG%" == "fr" echo Termin‚.
189    if "%GLILANG%" == "ru" echo ‚믮«­¥­®.
190    goto done
191
192
193:exit
194echo.
195pause
196color 07
197rem popd
198
199:done
200:: ---- Clean up ----
201set PERLPATH=
202set JAVA_EXECUTABLE=
203set GLIMODE=
204set PROGNAME=
205set PROGNAME_EN=
206set PROGFULLNAME=
207set PROGABBR=
208color 07
209rem popd
210cd "%startdir%"
211set startdir=
Note: See TracBrowser for help on using the browser.