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

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

Using shift to remove the extra arguments that we add to prevent infinite loops

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.8 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
47echo Checking if the collection directory is writable...
48echo This is a temporary file. It is safe to delete it. > "%GSDLHOME%\collect\testing.tmp" 2>nul
49if exist "%GSDLHOME%\collect\testing.tmp" goto deleteTempFile
50 if "%1" == "Elevated" goto shiftElevated
51 "%GSDLHOME%\bin\windows\gstart.exe" %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9
52 goto done
53
54:deleteTempFile
55del "%GSDLHOME%\collect\testing.tmp"
56
57:shiftElevated
58:: Shift "Elevated" (one of our own internal command words) out of the way if present
59:: so the command-line is as it was when the user initiated the command
60if "%1" == "Elevated" shift
61
62:findPerl
63:: Now need to find Perl. If found, PERLPATH will be set
64call findperl.bat
65if "%PERLPATH%" == "" goto exit
66
67:: Need to find Java. If found, JAVA_EXECUTABLE will be set
68call findjava.bat
69if "%JAVA_EXECUTABLE%" == "" goto exit
70
71
72:checkGLI
73:: ---- Check that the GLI has been compiled ----
74if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
75if exist "GLI.jar" goto runGLI
76 echo.
77 if "%GLILANG%" == "en" echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
78 if "%GLILANG%" == "en" echo before running this script.
79
80 if "%GLILANG%" == "es" echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone
81 if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este gui¢n.
82
83 if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
84 if "%GLILANG%" == "fr" echo avant d'ex‚cuter ce script.
85
86 if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
87 if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
88 goto exit
89
90
91:runGLI
92
93if not "%_VERSION%" == "" (
94 echo Greenstone Major Version :
95 echo %_VERSION%
96 echo.
97)
98
99if not "%GSDL3SRCHOME%" == "" (
100 echo GSDL3SRCHOME:
101 echo %GSDL3SRCHOME%
102 echo.
103)
104
105if not "%GSDL3HOME%" == "" (
106 echo GSDL3HOME:
107 echo %GSDL3HOME%
108 echo.
109)
110
111if not "%GSDLHOME%" == "" (
112 echo GSDLHOME:
113 echo %GSDLHOME%
114 echo.
115)
116
117:: ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ----
118echo.
119if 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.
120echo.
121echo.
122if 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.
123echo.
124echo.
125
126
127:: ---- Finally, run the GLI ----
128if "%GLILANG%" == "en" echo Running the %PROGNAME%...
129if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
130if "%GLILANG%" == "fr" echo Ex‚cution de %PROGNAME%
131if "%GLILANG%" == "ru" echo ’¥ªãéš© ¡š¡«š %PROGNAME%...
132
133:: -Xms32M To set minimum memory
134:: -Xmx32M To set maximum memory
135:: -verbose:gc To set garbage collection messages
136:: -Xincgc For incremental garbage collection
137:: -Xprof Function call profiling
138:: -Xloggc:<file> Write garbage collection log
139
140
141:: Run GS3 if version = 3
142if "%_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
143if "%_VERSION%" == "3" goto finRun
144
145:: Run GS2 since version is 2:
146:: if FLI is running, we don't want the local Greenstone library server running
147if "%PROGABBR%" == "FLI" goto webLib
148 :: Else we're running GLI, so we want the local Greenstone library server (if server.exe/gs2-server.bat exists, otherwise it will be webLib)
149 if not exist "%GSDLHOME%\server.exe" if not exist "%GSDLHOME%\gs2-server.bat" goto webLib
150
151:localLib
152 if exist "%GSDLHOME%\server.exe" (
153 set locallib=%GSDLHOME%\server.exe
154 ) else (
155 set locallib=%GSDLHOME%\gs2-server.bat
156 )
157
158 "%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
159 if ERRORLEVEL 2 (
160 goto localLib
161 )
162 goto finRun
163
164:webLib
165 "%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
166 if ERRORLEVEL 2 (
167 goto webLib
168 )
169 goto finRun
170
171:finRun
172 if "%GLILANG%" == "en" echo Done.
173 if "%GLILANG%" == "es" echo Hecho.
174 if "%GLILANG%" == "fr" echo Termin‚.
175 if "%GLILANG%" == "ru" echo ‚믮«­¥­®.
176 goto done
177
178
179:exit
180echo.
181pause
182color 07
183popd
184
185:done
186:: ---- Clean up ----
187set PERLPATH=
188set JAVA_EXECUTABLE=
189set GLIMODE=
190set PROGNAME=
191set PROGNAME_EN=
192set PROGFULLNAME=
193set PROGABBR=
194color 07
195popd
Note: See TracBrowser for help on using the repository browser.