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
RevLine 
[5824]1@echo off
[17942]2color 0A
[23650]3set startdir=%CD%
4rem pushd "%CD%"
[17942]5CD /D "%~dp0"
[6749]6set GLILANG=en
[5824]7
[19388]8if "%GLIMODE%" == "" set GLIMODE=local
[6749]9
[5824]10:: -------- Run the Greenstone Librarian Interface --------
11
12:: This script must be run from within the directory in which it lives
[22526]13if exist gli.bat goto start
[6749]14 if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
[6753]15 if "%GLILANG%" == "es" echo Este gui¢n deber  ejecutarse desde el directorio en el que reside.
[6749]16 if "%GLILANG%" == "fr" echo Ce script doit ˆtre ex‚cut‚ …
[6754]17 partir du r‚pertoire dans lequel il se trouve.
[5824]18 if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥­ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ®­ à á¯®«®Š¥­
[22525]19 goto exit
[5824]20
[15608]21:start
[5824]22if "%OS%" == "Windows_NT" goto progName
[15608]23 :: Invoke a new command processor to ensure there's enough environment space
[22530]24 if "%1" == "Second" goto progName
25 command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
26 shift
[5824]27 goto done
[15608]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
[19388]41
[6669]42:: Now need to work out the _VERSION, GSDLHOME (and if GS3, then GSDL3SRCHOME and GSDL3HOME)
[19388]43:findGSDL
44call findgsdl.bat
[6749]45if "%GSDLHOME%" == "" goto exit
[22526]46
[22575]47:checkUserPermissions
[22574]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)
[22530]55 echo Requesting elevated status to become admin user to continue.
[22526]56 "%GSDLHOME%\bin\windows\gstart.exe" %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9
[22574]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.
[22530]63 goto shiftElevated
[22526]64
[22574]65:deleteTempFile
66 echo ... OK
[22526]67 del "%GSDLHOME%\collect\testing.tmp"
[22530]68
69:shiftElevated
70:: Shift "Elevated" (one of our own internal command words) out of the way if present
[22574]71:: so the command-line is as it was when the user initiated the command
[22530]72 if "%1" == "Elevated" shift
[23650]73
74:: Make sure we're in the GLI folder, even if located outside a GS installation
75CD /D "%~dp0"
[22526]76
[22530]77:findPerl
[19336]78:: Now need to find Perl. If found, PERLPATH will be set
79call findperl.bat
[5824]80if "%PERLPATH%" == "" goto exit
[19336]81
82:: Need to find Java. If found, JAVA_EXECUTABLE will be set
83call findjava.bat
[5824]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
[6749]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.
[6753]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.
[10787]97
[6749]98 if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
[6754]99 if "%GLILANG%" == "fr" echo avant d'ex‚cuter ce script.
100
101 if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
[5824]102 if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
103 goto exit
104
105
[17671]106:runGLI
[17332]107
[22409]108if not "%_VERSION%" == "" (
109 echo Greenstone Major Version :
[17332]110 echo %_VERSION%
111 echo.
[7680]112)
[17332]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)
[17671]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
[15629]142:: ---- Finally, run the GLI ----
143if "%GLILANG%" == "en" echo Running the %PROGNAME%...
144if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
[16548]145if "%GLILANG%" == "fr" echo Ex‚cution de %PROGNAME%
[5824]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
[12695]154
[15608]155
[19390]156:: Run GS3 if version = 3
[15608]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
[22575]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)
[15608]164 if not exist "%GSDLHOME%\server.exe" if not exist "%GSDLHOME%\gs2-web-server.bat" goto webLib
[20479]165
166:localLib
167 if exist "%GSDLHOME%\server.exe" (
168 set locallib=%GSDLHOME%\server.exe
[22575]169 ) else (
[17474]170 set locallib=%GSDLHOME%\gs2-web-server.bat
[12689]171 )
[20479]172
[18408]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 (
[17474]175 goto localLib
[15608]176 )
[12689]177 goto finRun
[20479]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 )
[15608]184 goto finRun
185
[22409]186:finRun
187 if "%GLILANG%" == "en" echo Done.
188 if "%GLILANG%" == "es" echo Hecho.
189 if "%GLILANG%" == "fr" echo Termin‚.
[5927]190 if "%GLILANG%" == "ru" echo ‚믮«­¥­®.
[5824]191 goto done
[15608]192
[5824]193
194:exit
195echo.
[17942]196pause
[23650]197color 07
[5824]198rem popd
[5927]199
[5824]200:done
201:: ---- Clean up ----
[17501]202set PERLPATH=
[19388]203set JAVA_EXECUTABLE=
204set GLIMODE=
205set PROGNAME=
206set PROGNAME_EN=
207set PROGFULLNAME=
[17942]208set PROGABBR=
[23650]209color 07
210rem popd
211cd "%startdir%"
212set startdir=
Note: See TracBrowser for help on using the repository browser.