[5824] | 1 | @echo off
|
---|
[24829] | 2 | setlocal enabledelayedexpansion
|
---|
| 3 |
|
---|
[17942] | 4 | color 0A
|
---|
[23650] | 5 | set startdir=%CD%
|
---|
| 6 | rem pushd "%CD%"
|
---|
[17942] | 7 | CD /D "%~dp0"
|
---|
[6749] | 8 | set GLILANG=en
|
---|
[5824] | 9 |
|
---|
[19388] | 10 | if "%GLIMODE%" == "" set GLIMODE=local
|
---|
[6749] | 11 |
|
---|
[5824] | 12 | :: -------- Run the Greenstone Librarian Interface --------
|
---|
| 13 |
|
---|
| 14 | :: This script must be run from within the directory in which it lives
|
---|
[22526] | 15 | if exist gli.bat goto start
|
---|
[6749] | 16 | if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
|
---|
[6753] | 17 | if "%GLILANG%" == "es" echo Este gui¢n deber ejecutarse desde el directorio en el que reside.
|
---|
[6749] | 18 | if "%GLILANG%" == "fr" echo Ce script doit tre excut
|
---|
[6754] | 19 | partir du rpertoire dans lequel il se trouve.
|
---|
[5824] | 20 | if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ® à ᯮ«®Š¥
|
---|
[22525] | 21 | goto exit
|
---|
[5824] | 22 |
|
---|
[15608] | 23 | :start
|
---|
[5824] | 24 | if "%OS%" == "Windows_NT" goto progName
|
---|
[15608] | 25 | :: Invoke a new command processor to ensure there's enough environment space
|
---|
[22530] | 26 | if "%1" == "Second" goto progName
|
---|
| 27 | command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
| 28 | shift
|
---|
[5824] | 29 | goto done
|
---|
[15608] | 30 |
|
---|
| 31 | :progName
|
---|
| 32 | if not "%PROGNAME%" == "" goto findGSDL
|
---|
| 33 | :: otherwise PROGNAME was not set, so default to the Greenstone Librarian Interface (GLI) program
|
---|
| 34 | if "%GLILANG%" == "es" set PROGNAME=Biblioteca Digital Greenstone
|
---|
| 35 | if "%GLILANG%" == "fr" set PROGNAME=Bibliothécaire Greenstone
|
---|
| 36 | if "%GLILANG%" == "ru" set PROGNAME=ÉÎÔÅÒÆÅÊÓ Greenstone
|
---|
| 37 | :: if the PROGNAME is still not set, then set the language to English
|
---|
| 38 | if "%PROGNAME%" == "" set PROGNAME=Greenstone Librarian Interface
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 | if "%PROGABBR%" == "" set PROGABBR=GLI
|
---|
| 42 | if "%PROGNAME_EN%" == "" set PROGNAME_EN=Greenstone Librarian Interface
|
---|
[19388] | 43 |
|
---|
[6669] | 44 | :: Now need to work out the _VERSION, GSDLHOME (and if GS3, then GSDL3SRCHOME and GSDL3HOME)
|
---|
[19388] | 45 | :findGSDL
|
---|
| 46 | call findgsdl.bat
|
---|
[6749] | 47 | if "%GSDLHOME%" == "" goto exit
|
---|
[22526] | 48 |
|
---|
[30568] | 49 | :checkUserPermissions
|
---|
[30573] | 50 |
|
---|
[30568] | 51 | rem In a web-dispersed GS3 setup like in the labs, we don't require the Greenstone directory to be writable.
|
---|
| 52 | rem If GS3, get the using.user.web property from build.properties and if set to true, we can skip to shiftElevated
|
---|
[30592] | 53 | :: http://ss64.com/nt/syntax-substring.html
|
---|
[30568] | 54 | if "%_VERSION%" == "3" if exist "%GSDL3SRCHOME%\build.properties" for /F "usebackq tokens=1,2 delims==" %%G in ("%GSDL3SRCHOME%\build.properties") do (
|
---|
| 55 | if "%%G" == "using.user.web" if "%%H" == "true" goto :shiftElevated
|
---|
[22575] | 56 | )
|
---|
[22574] | 57 | echo.
|
---|
[24829] | 58 | echo Checking if the Greenstone collection directory is writable ...
|
---|
[22574] | 59 | (echo This is a temporary file. It is safe to delete it. > "!GSDLHOME!\collect\testing.tmp" ) 2>nul
|
---|
| 60 | if exist "%GSDLHOME%\collect\testing.tmp" goto deleteTempFile
|
---|
| 61 | if "%1" == "Elevated" goto printWarning
|
---|
[24829] | 62 | echo ... FAILED
|
---|
[22574] | 63 | echo The %PROGNAME% cannot write to the collection directory (!GSDLHOME!\collect)
|
---|
[22530] | 64 | echo Requesting elevated status to become admin user to continue.
|
---|
[22526] | 65 | "%GSDLHOME%\bin\windows\gstart.exe" %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
[22574] | 66 | goto done
|
---|
| 67 |
|
---|
| 68 | :printWarning
|
---|
[24829] | 69 | echo ... FAILED
|
---|
[22574] | 70 | echo The %PROGNAME% cannot write to the log directory (!GSDLHOME!\collect).
|
---|
| 71 | echo Attempting to continue without permissions.
|
---|
[22530] | 72 | goto shiftElevated
|
---|
[22526] | 73 |
|
---|
[22574] | 74 | :deleteTempFile
|
---|
| 75 | echo ... OK
|
---|
[22526] | 76 | del "%GSDLHOME%\collect\testing.tmp"
|
---|
[22530] | 77 |
|
---|
| 78 | :shiftElevated
|
---|
| 79 | :: Shift "Elevated" (one of our own internal command words) out of the way if present
|
---|
[22574] | 80 | :: so the command-line is as it was when the user initiated the command
|
---|
[22530] | 81 | if "%1" == "Elevated" shift
|
---|
[23650] | 82 |
|
---|
| 83 | :: Make sure we're in the GLI folder, even if located outside a GS installation
|
---|
| 84 | CD /D "%~dp0"
|
---|
[22526] | 85 |
|
---|
[22530] | 86 | :findPerl
|
---|
[19336] | 87 | :: Now need to find Perl. If found, PERLPATH will be set
|
---|
| 88 | call findperl.bat
|
---|
[5824] | 89 | if "%PERLPATH%" == "" goto exit
|
---|
[19336] | 90 |
|
---|
| 91 | :: Need to find Java. If found, JAVA_EXECUTABLE will be set
|
---|
| 92 | call findjava.bat
|
---|
[5824] | 93 | if "%JAVA_EXECUTABLE%" == "" goto exit
|
---|
| 94 |
|
---|
| 95 |
|
---|
| 96 | :checkGLI
|
---|
| 97 | :: ---- Check that the GLI has been compiled ----
|
---|
| 98 | if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
|
---|
| 99 | if exist "GLI.jar" goto runGLI
|
---|
[6749] | 100 | echo.
|
---|
| 101 | if "%GLILANG%" == "en" echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
|
---|
| 102 | if "%GLILANG%" == "en" echo before running this script.
|
---|
[6753] | 103 |
|
---|
| 104 | if "%GLILANG%" == "es" echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone
|
---|
| 105 | if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este gui¢n.
|
---|
[10787] | 106 |
|
---|
[6749] | 107 | if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
|
---|
[6754] | 108 | if "%GLILANG%" == "fr" echo avant d'excuter ce script.
|
---|
| 109 |
|
---|
| 110 | if "%GLILANG%" == "ru" echo ë €®«Šë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥çë© šâ¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
|
---|
[5824] | 111 | if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â
|
---|
| 112 | goto exit
|
---|
| 113 |
|
---|
| 114 |
|
---|
[17671] | 115 | :runGLI
|
---|
[17332] | 116 |
|
---|
[22409] | 117 | if not "%_VERSION%" == "" (
|
---|
| 118 | echo Greenstone Major Version :
|
---|
[17332] | 119 | echo %_VERSION%
|
---|
| 120 | echo.
|
---|
[7680] | 121 | )
|
---|
[17332] | 122 |
|
---|
| 123 | if not "%GSDL3SRCHOME%" == "" (
|
---|
[24829] | 124 | echo GSDL3SRCHOME:
|
---|
[17332] | 125 | echo !GSDL3SRCHOME!
|
---|
| 126 | echo.
|
---|
| 127 | )
|
---|
| 128 |
|
---|
| 129 | if not "%GSDL3HOME%" == "" (
|
---|
[24829] | 130 | echo GSDL3HOME:
|
---|
[17332] | 131 | echo !GSDL3HOME!
|
---|
| 132 | echo.
|
---|
| 133 | )
|
---|
| 134 |
|
---|
| 135 | if not "%GSDLHOME%" == "" (
|
---|
[24829] | 136 | echo GSDLHOME:
|
---|
[17332] | 137 | echo !GSDLHOME!
|
---|
| 138 | echo.
|
---|
| 139 | )
|
---|
[17671] | 140 |
|
---|
| 141 | :: ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ----
|
---|
| 142 | echo.
|
---|
| 143 | 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.
|
---|
| 144 | echo.
|
---|
| 145 | echo.
|
---|
| 146 | 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.
|
---|
| 147 | echo.
|
---|
| 148 | echo.
|
---|
| 149 |
|
---|
| 150 |
|
---|
[15629] | 151 | :: ---- Finally, run the GLI ----
|
---|
| 152 | if "%GLILANG%" == "en" echo Running the %PROGNAME%...
|
---|
| 153 | if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
|
---|
[16548] | 154 | if "%GLILANG%" == "fr" echo Excution de %PROGNAME%
|
---|
[5824] | 155 | if "%GLILANG%" == "ru" echo ¥ªãéš© ¡š¡«š %PROGNAME%...
|
---|
| 156 |
|
---|
| 157 | :: -Xms32M To set minimum memory
|
---|
| 158 | :: -Xmx32M To set maximum memory
|
---|
| 159 | :: -verbose:gc To set garbage collection messages
|
---|
| 160 | :: -Xincgc For incremental garbage collection
|
---|
| 161 | :: -Xprof Function call profiling
|
---|
| 162 | :: -Xloggc:<file> Write garbage collection log
|
---|
[12695] | 163 |
|
---|
[15608] | 164 |
|
---|
[25939] | 165 | :: Run GS3 if version = 3
|
---|
[30568] | 166 | :rungs3
|
---|
[30573] | 167 |
|
---|
[30574] | 168 | rem In a web-dispersed GS3 set up like in the labs, gsdl3home.isreadonly would be true and
|
---|
[30592] | 169 | rem we need to run the web server in read-only mode. This section of code borrowed from gs3-server.bat.
|
---|
[30574] | 170 | for /F "usebackq tokens=1,2 delims==" %%G in ("%GSDL3SRCHOME%\build.properties") do (
|
---|
| 171 | if "%%G"=="gsdl3home.isreadonly" if "%%H" == "true" (
|
---|
| 172 | set gsdl3_writablehome=%TMP%\greenstone\web
|
---|
| 173 | :: not used
|
---|
| 174 | set opt_properties="-Dgsdl3home.isreadonly=true" -Dgsdl3.writablehome="%gsdl3_writablehome%"
|
---|
[30592] | 175 | echo Setting Greenstone3 web home writable area to be: %gsdl3_writablehome%
|
---|
[30574] | 176 | pushd "%GSDL3SRCHOME%"
|
---|
| 177 | :: passing opt_properties is no longer necessary because ant.bat is unmodified (doesn't make use of it)
|
---|
| 178 | :: and because build.xml already contains the properties with the correct values
|
---|
| 179 | cmd /c ant.bat %opt_properties% configure-web
|
---|
| 180 | popd
|
---|
[30568] | 181 | )
|
---|
| 182 | )
|
---|
[25939] | 183 |
|
---|
| 184 | if "%_VERSION%" == "3" "%JAVA_EXECUTABLE%" -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar;lib/rsyntaxtextarea.jar org.greenstone.gatherer.GathererProg -gsdl "%GSDLHOME%" -gsdlos %GSDLOS% -gsdl3 "%GSDL3HOME%" -gsdl3src "%GSDL3SRCHOME%" -perl "%PERLPATH%" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
| 185 | if ERRORLEVEL 2 (
|
---|
| 186 | goto rungs3
|
---|
| 187 | )
|
---|
[15608] | 188 | if "%_VERSION%" == "3" goto finRun
|
---|
| 189 |
|
---|
| 190 | :: Run GS2 since version is 2:
|
---|
| 191 | :: if FLI is running, we don't want the local Greenstone library server running
|
---|
[22575] | 192 | if "%PROGABBR%" == "FLI" goto webLib
|
---|
| 193 | :: 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)
|
---|
[15608] | 194 | if not exist "%GSDLHOME%\server.exe" if not exist "%GSDLHOME%\gs2-web-server.bat" goto webLib
|
---|
[20479] | 195 |
|
---|
| 196 | :localLib
|
---|
[24829] | 197 | if exist "%GSDLHOME%\server.exe" (
|
---|
[20479] | 198 | set locallib=!GSDLHOME!\server.exe
|
---|
[24829] | 199 | ) else (
|
---|
[17474] | 200 | set locallib=!GSDLHOME!\gs2-web-server.bat
|
---|
[12689] | 201 | )
|
---|
[25682] | 202 |
|
---|
[18408] | 203 | "%JAVA_EXECUTABLE%" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar;lib/rsyntaxtextarea.jar org.greenstone.gatherer.GathererProg -gsdl "%GSDLHOME%" -gsdlos %GSDLOS% -perl "%PERLPATH%" -local_library "%locallib%" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
| 204 | if ERRORLEVEL 2 (
|
---|
[17474] | 205 | goto localLib
|
---|
[15608] | 206 | )
|
---|
[12689] | 207 | goto finRun
|
---|
[20479] | 208 |
|
---|
[25682] | 209 | :webLib
|
---|
[20479] | 210 | "%JAVA_EXECUTABLE%" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar;lib/rsyntaxtextarea.jar org.greenstone.gatherer.GathererProg -gsdl "%GSDLHOME%" -gsdlos %GSDLOS% -perl "%PERLPATH%" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
| 211 | if ERRORLEVEL 2 (
|
---|
| 212 | goto webLib
|
---|
| 213 | )
|
---|
[15608] | 214 | goto finRun
|
---|
| 215 |
|
---|
[22409] | 216 | :finRun
|
---|
| 217 | if "%GLILANG%" == "en" echo Done.
|
---|
| 218 | if "%GLILANG%" == "es" echo Hecho.
|
---|
| 219 | if "%GLILANG%" == "fr" echo Termin.
|
---|
[5927] | 220 | if "%GLILANG%" == "ru" echo 믮«¥®.
|
---|
[5824] | 221 | goto done
|
---|
[15608] | 222 |
|
---|
[5824] | 223 |
|
---|
| 224 | :exit
|
---|
| 225 | echo.
|
---|
[17942] | 226 | pause
|
---|
[23650] | 227 | color 07
|
---|
[5824] | 228 | rem popd
|
---|
[5927] | 229 |
|
---|
[5824] | 230 | :done
|
---|
| 231 | :: ---- Clean up ----
|
---|
[17501] | 232 | set PERLPATH=
|
---|
[19388] | 233 | set JAVA_EXECUTABLE=
|
---|
| 234 | set GLIMODE=
|
---|
| 235 | set PROGNAME=
|
---|
| 236 | set PROGNAME_EN=
|
---|
| 237 | set PROGFULLNAME=
|
---|
[17942] | 238 | set PROGABBR=
|
---|
[23650] | 239 | color 07
|
---|
| 240 | rem popd
|
---|
| 241 | cd "%startdir%"
|
---|
[24829] | 242 | set startdir=
|
---|
| 243 |
|
---|
| 244 | endlocal
|
---|