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

Last change on this file since 24904 was 24829, checked in by ak19, 12 years ago

Changes to bat files and perl code to deal with brackets in (Windows) filepath. Also checked winmake.bat files to see if changes were needed there. These changes go together with the commits 24826 to 24828 for gems.bat, and commit 24820 on makegs2.bat.

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