1 | @echo off
|
---|
2 | color 0A
|
---|
3 | pushd "%CD%"
|
---|
4 | CD /D "%~dp0"
|
---|
5 | set GLILANG=en
|
---|
6 |
|
---|
7 | if "%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
|
---|
12 | if 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 excut
|
---|
16 | partir du rpertoire dans lequel il se trouve.
|
---|
17 | if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ® à ᯮ«®Š¥
|
---|
18 | goto exit
|
---|
19 |
|
---|
20 | :start
|
---|
21 | if "%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
|
---|
29 | if 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 |
|
---|
38 | if "%PROGABBR%" == "" set PROGABBR=GLI
|
---|
39 | if "%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
|
---|
43 | call findgsdl.bat
|
---|
44 | if "%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
|
---|
75 | call findperl.bat
|
---|
76 | if "%PERLPATH%" == "" goto exit
|
---|
77 |
|
---|
78 | :: Need to find Java. If found, JAVA_EXECUTABLE will be set
|
---|
79 | call findjava.bat
|
---|
80 | if "%JAVA_EXECUTABLE%" == "" goto exit
|
---|
81 |
|
---|
82 |
|
---|
83 | :checkGLI
|
---|
84 | :: ---- Check that the GLI has been compiled ----
|
---|
85 | if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
|
---|
86 | if 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'excuter ce script.
|
---|
96 |
|
---|
97 | if "%GLILANG%" == "ru" echo ë €®«Šë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥çë© šâ¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
|
---|
98 | if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â
|
---|
99 | goto exit
|
---|
100 |
|
---|
101 |
|
---|
102 | :runGLI
|
---|
103 |
|
---|
104 | if not "%_VERSION%" == "" (
|
---|
105 | echo Greenstone Major Version :
|
---|
106 | echo %_VERSION%
|
---|
107 | echo.
|
---|
108 | )
|
---|
109 |
|
---|
110 | if not "%GSDL3SRCHOME%" == "" (
|
---|
111 | echo GSDL3SRCHOME:
|
---|
112 | echo %GSDL3SRCHOME%
|
---|
113 | echo.
|
---|
114 | )
|
---|
115 |
|
---|
116 | if not "%GSDL3HOME%" == "" (
|
---|
117 | echo GSDL3HOME:
|
---|
118 | echo %GSDL3HOME%
|
---|
119 | echo.
|
---|
120 | )
|
---|
121 |
|
---|
122 | if 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 ----
|
---|
129 | echo.
|
---|
130 | 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.
|
---|
131 | echo.
|
---|
132 | echo.
|
---|
133 | 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.
|
---|
134 | echo.
|
---|
135 | echo.
|
---|
136 |
|
---|
137 |
|
---|
138 | :: ---- Finally, run the GLI ----
|
---|
139 | if "%GLILANG%" == "en" echo Running the %PROGNAME%...
|
---|
140 | if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
|
---|
141 | if "%GLILANG%" == "fr" echo Excution de %PROGNAME%
|
---|
142 | if "%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
|
---|
153 | 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
|
---|
154 | if "%_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
|
---|
158 | if "%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
|
---|
191 | echo.
|
---|
192 | pause
|
---|
193 | color 07
|
---|
194 | popd
|
---|
195 |
|
---|
196 | :done
|
---|
197 | :: ---- Clean up ----
|
---|
198 | set PERLPATH=
|
---|
199 | set JAVA_EXECUTABLE=
|
---|
200 | set GLIMODE=
|
---|
201 | set PROGNAME=
|
---|
202 | set PROGNAME_EN=
|
---|
203 | set PROGFULLNAME=
|
---|
204 | set PROGABBR=
|
---|
205 | color 07
|
---|
206 | popd
|
---|