source: main/trunk/gli/gli.bat@ 23650

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