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

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

GLI in Windows will now ask for elevated permissions if it cannot write to the collect folder

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