1 | @echo off
|
---|
2 | color 0A
|
---|
3 | set startdir=%CD%
|
---|
4 | rem pushd "%CD%"
|
---|
5 | CD /D "%~dp0"
|
---|
6 | set GLILANG=en
|
---|
7 |
|
---|
8 | if "%GLIMODE%" == "" set GLIMODE=local
|
---|
9 |
|
---|
10 | :: -------- Run the Greenstone Librarian Interface --------
|
---|
11 |
|
---|
12 | :: This script must be run from within the directory in which it lives
|
---|
13 | if exist gli.bat goto start
|
---|
14 | if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
|
---|
15 | if "%GLILANG%" == "es" echo Este gui¢n deber ejecutarse desde el directorio en el que reside.
|
---|
16 | if "%GLILANG%" == "fr" echo Ce script doit tre excut
|
---|
17 | partir du rpertoire dans lequel il se trouve.
|
---|
18 | if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ® à ᯮ«®Š¥
|
---|
19 | goto exit
|
---|
20 |
|
---|
21 | :start
|
---|
22 | if "%OS%" == "Windows_NT" goto progName
|
---|
23 | :: Invoke a new command processor to ensure there's enough environment space
|
---|
24 | if "%1" == "Second" goto progName
|
---|
25 | command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
26 | shift
|
---|
27 | goto done
|
---|
28 |
|
---|
29 | :progName
|
---|
30 | if 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 |
|
---|
39 | if "%PROGABBR%" == "" set PROGABBR=GLI
|
---|
40 | if "%PROGNAME_EN%" == "" set PROGNAME_EN=Greenstone Librarian Interface
|
---|
41 |
|
---|
42 | :: Now need to work out the _VERSION, GSDLHOME (and if GS3, then GSDL3SRCHOME and GSDL3HOME)
|
---|
43 | :findGSDL
|
---|
44 | call findgsdl.bat
|
---|
45 | if "%GSDLHOME%" == "" goto exit
|
---|
46 |
|
---|
47 | :checkUserPermissions
|
---|
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)
|
---|
55 | echo Requesting elevated status to become admin user to continue.
|
---|
56 | "%GSDLHOME%\bin\windows\gstart.exe" %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
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.
|
---|
63 | goto shiftElevated
|
---|
64 |
|
---|
65 | :deleteTempFile
|
---|
66 | echo ... OK
|
---|
67 | del "%GSDLHOME%\collect\testing.tmp"
|
---|
68 |
|
---|
69 | :shiftElevated
|
---|
70 | :: Shift "Elevated" (one of our own internal command words) out of the way if present
|
---|
71 | :: so the command-line is as it was when the user initiated the command
|
---|
72 | if "%1" == "Elevated" shift
|
---|
73 |
|
---|
74 | :: Make sure we're in the GLI folder, even if located outside a GS installation
|
---|
75 | CD /D "%~dp0"
|
---|
76 |
|
---|
77 | :findPerl
|
---|
78 | :: Now need to find Perl. If found, PERLPATH will be set
|
---|
79 | call findperl.bat
|
---|
80 | if "%PERLPATH%" == "" goto exit
|
---|
81 |
|
---|
82 | :: Need to find Java. If found, JAVA_EXECUTABLE will be set
|
---|
83 | call findjava.bat
|
---|
84 | if "%JAVA_EXECUTABLE%" == "" goto exit
|
---|
85 |
|
---|
86 |
|
---|
87 | :checkGLI
|
---|
88 | :: ---- Check that the GLI has been compiled ----
|
---|
89 | if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
|
---|
90 | if exist "GLI.jar" goto runGLI
|
---|
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.
|
---|
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.
|
---|
97 |
|
---|
98 | if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
|
---|
99 | if "%GLILANG%" == "fr" echo avant d'excuter ce script.
|
---|
100 |
|
---|
101 | if "%GLILANG%" == "ru" echo ë €®«Šë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥çë© šâ¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
|
---|
102 | if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â
|
---|
103 | goto exit
|
---|
104 |
|
---|
105 |
|
---|
106 | :runGLI
|
---|
107 |
|
---|
108 | if not "%_VERSION%" == "" (
|
---|
109 | echo Greenstone Major Version :
|
---|
110 | echo %_VERSION%
|
---|
111 | echo.
|
---|
112 | )
|
---|
113 |
|
---|
114 | if not "%GSDL3SRCHOME%" == "" (
|
---|
115 | echo GSDL3SRCHOME:
|
---|
116 | echo %GSDL3SRCHOME%
|
---|
117 | echo.
|
---|
118 | )
|
---|
119 |
|
---|
120 | if not "%GSDL3HOME%" == "" (
|
---|
121 | echo GSDL3HOME:
|
---|
122 | echo %GSDL3HOME%
|
---|
123 | echo.
|
---|
124 | )
|
---|
125 |
|
---|
126 | if not "%GSDLHOME%" == "" (
|
---|
127 | echo GSDLHOME:
|
---|
128 | echo %GSDLHOME%
|
---|
129 | echo.
|
---|
130 | )
|
---|
131 |
|
---|
132 | :: ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ----
|
---|
133 | echo.
|
---|
134 | if 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.
|
---|
135 | echo.
|
---|
136 | echo.
|
---|
137 | if 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.
|
---|
138 | echo.
|
---|
139 | echo.
|
---|
140 |
|
---|
141 |
|
---|
142 | :: ---- Finally, run the GLI ----
|
---|
143 | if "%GLILANG%" == "en" echo Running the %PROGNAME%...
|
---|
144 | if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
|
---|
145 | if "%GLILANG%" == "fr" echo Excution de %PROGNAME%
|
---|
146 | if "%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
|
---|
154 |
|
---|
155 |
|
---|
156 | :: Run GS3 if version = 3
|
---|
157 | if "%_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
|
---|
158 | if "%_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
|
---|
162 | if "%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)
|
---|
164 | if not exist "%GSDLHOME%\server.exe" if not exist "%GSDLHOME%\gs2-web-server.bat" goto webLib
|
---|
165 |
|
---|
166 | :localLib
|
---|
167 | if exist "%GSDLHOME%\server.exe" (
|
---|
168 | set locallib=%GSDLHOME%\server.exe
|
---|
169 | ) else (
|
---|
170 | set locallib=%GSDLHOME%\gs2-web-server.bat
|
---|
171 | )
|
---|
172 |
|
---|
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 (
|
---|
175 | goto localLib
|
---|
176 | )
|
---|
177 | goto finRun
|
---|
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 | )
|
---|
184 | goto finRun
|
---|
185 |
|
---|
186 | :finRun
|
---|
187 | if "%GLILANG%" == "en" echo Done.
|
---|
188 | if "%GLILANG%" == "es" echo Hecho.
|
---|
189 | if "%GLILANG%" == "fr" echo Termin.
|
---|
190 | if "%GLILANG%" == "ru" echo 믮«¥®.
|
---|
191 | goto done
|
---|
192 |
|
---|
193 |
|
---|
194 | :exit
|
---|
195 | echo.
|
---|
196 | pause
|
---|
197 | color 07
|
---|
198 | rem popd
|
---|
199 |
|
---|
200 | :done
|
---|
201 | :: ---- Clean up ----
|
---|
202 | set PERLPATH=
|
---|
203 | set JAVA_EXECUTABLE=
|
---|
204 | set GLIMODE=
|
---|
205 | set PROGNAME=
|
---|
206 | set PROGNAME_EN=
|
---|
207 | set PROGFULLNAME=
|
---|
208 | set PROGABBR=
|
---|
209 | color 07
|
---|
210 | rem popd
|
---|
211 | cd "%startdir%"
|
---|
212 | set startdir=
|
---|