source: main/tags/stable/gli/gli.bat@ 23214

Last change on this file since 23214 was 22575, checked in by sjm84, 14 years ago

Corrected a small error in gli.bat and tidied the script in both gli.bat and gems.bat

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 7.2 KB
Line 
1@echo off
2color 0A
3pushd "%CD%"
4CD /D "%~dp0"
5set GLILANG=en
6
7if "%GLIMODE%" == "" set GLIMODE=local
8
9:: -------- Run the Greenstone Librarian Interface --------
10
11:: This script must be run from within the directory in which it lives
12if exist gli.bat goto start
13 if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
14 if "%GLILANG%" == "es" echo Este gui¢n deber  ejecutarse desde el directorio en el que reside.
15 if "%GLILANG%" == "fr" echo Ce script doit ˆtre ex‚cut‚ …
16 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:findPerl
74:: Now need to find Perl. If found, PERLPATH will be set
75call findperl.bat
76if "%PERLPATH%" == "" goto exit
77
78:: Need to find Java. If found, JAVA_EXECUTABLE will be set
79call findjava.bat
80if "%JAVA_EXECUTABLE%" == "" goto exit
81
82
83:checkGLI
84:: ---- Check that the GLI has been compiled ----
85if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
86if exist "GLI.jar" goto runGLI
87 echo.
88 if "%GLILANG%" == "en" echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
89 if "%GLILANG%" == "en" echo before running this script.
90
91 if "%GLILANG%" == "es" echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone
92 if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este gui¢n.
93
94 if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
95 if "%GLILANG%" == "fr" echo avant d'ex‚cuter ce script.
96
97 if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
98 if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
99 goto exit
100
101
102:runGLI
103
104if not "%_VERSION%" == "" (
105 echo Greenstone Major Version :
106 echo %_VERSION%
107 echo.
108)
109
110if not "%GSDL3SRCHOME%" == "" (
111 echo GSDL3SRCHOME:
112 echo %GSDL3SRCHOME%
113 echo.
114)
115
116if not "%GSDL3HOME%" == "" (
117 echo GSDL3HOME:
118 echo %GSDL3HOME%
119 echo.
120)
121
122if not "%GSDLHOME%" == "" (
123 echo GSDLHOME:
124 echo %GSDLHOME%
125 echo.
126)
127
128:: ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ----
129echo.
130if 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.
131echo.
132echo.
133if 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.
134echo.
135echo.
136
137
138:: ---- Finally, run the GLI ----
139if "%GLILANG%" == "en" echo Running the %PROGNAME%...
140if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
141if "%GLILANG%" == "fr" echo Ex‚cution de %PROGNAME%
142if "%GLILANG%" == "ru" echo ’¥ªãéš© ¡š¡«š %PROGNAME%...
143
144:: -Xms32M To set minimum memory
145:: -Xmx32M To set maximum memory
146:: -verbose:gc To set garbage collection messages
147:: -Xincgc For incremental garbage collection
148:: -Xprof Function call profiling
149:: -Xloggc:<file> Write garbage collection log
150
151
152:: Run GS3 if version = 3
153if "%_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
154if "%_VERSION%" == "3" goto finRun
155
156:: Run GS2 since version is 2:
157:: if FLI is running, we don't want the local Greenstone library server running
158if "%PROGABBR%" == "FLI" goto webLib
159 :: 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)
160 if not exist "%GSDLHOME%\server.exe" if not exist "%GSDLHOME%\gs2-web-server.bat" goto webLib
161
162:localLib
163 if exist "%GSDLHOME%\server.exe" (
164 set locallib=%GSDLHOME%\server.exe
165 ) else (
166 set locallib=%GSDLHOME%\gs2-web-server.bat
167 )
168
169 "%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
170 if ERRORLEVEL 2 (
171 goto localLib
172 )
173 goto finRun
174
175:webLib
176 "%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
177 if ERRORLEVEL 2 (
178 goto webLib
179 )
180 goto finRun
181
182:finRun
183 if "%GLILANG%" == "en" echo Done.
184 if "%GLILANG%" == "es" echo Hecho.
185 if "%GLILANG%" == "fr" echo Termin‚.
186 if "%GLILANG%" == "ru" echo ‚믮«­¥­®.
187 goto done
188
189
190:exit
191echo.
192pause
193color 07
194popd
195
196:done
197:: ---- Clean up ----
198set PERLPATH=
199set JAVA_EXECUTABLE=
200set GLIMODE=
201set PROGNAME=
202set PROGNAME_EN=
203set PROGFULLNAME=
204set PROGABBR=
205color 07
206popd
Note: See TracBrowser for help on using the repository browser.