[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 |
|
---|
[22575] | 49 | :checkUserPermissions
|
---|
[22574] | 50 | echo.
|
---|
[24829] | 51 | echo Checking if the Greenstone collection directory is writable ...
|
---|
[22574] | 52 | (echo This is a temporary file. It is safe to delete it. > "!GSDLHOME!\collect\testing.tmp" ) 2>nul
|
---|
| 53 | if exist "%GSDLHOME%\collect\testing.tmp" goto deleteTempFile
|
---|
| 54 | if "%1" == "Elevated" goto printWarning
|
---|
[24829] | 55 | echo ... FAILED
|
---|
[22574] | 56 | echo The %PROGNAME% cannot write to the collection directory (!GSDLHOME!\collect)
|
---|
[22530] | 57 | echo Requesting elevated status to become admin user to continue.
|
---|
[22526] | 58 | "%GSDLHOME%\bin\windows\gstart.exe" %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
[22574] | 59 | goto done
|
---|
| 60 |
|
---|
| 61 | :printWarning
|
---|
[24829] | 62 | echo ... FAILED
|
---|
[22574] | 63 | echo The %PROGNAME% cannot write to the log directory (!GSDLHOME!\collect).
|
---|
| 64 | echo Attempting to continue without permissions.
|
---|
[22530] | 65 | goto shiftElevated
|
---|
[22526] | 66 |
|
---|
[22574] | 67 | :deleteTempFile
|
---|
| 68 | echo ... OK
|
---|
[22526] | 69 | del "%GSDLHOME%\collect\testing.tmp"
|
---|
[22530] | 70 |
|
---|
| 71 | :shiftElevated
|
---|
| 72 | :: Shift "Elevated" (one of our own internal command words) out of the way if present
|
---|
[22574] | 73 | :: so the command-line is as it was when the user initiated the command
|
---|
[22530] | 74 | if "%1" == "Elevated" shift
|
---|
[23650] | 75 |
|
---|
| 76 | :: Make sure we're in the GLI folder, even if located outside a GS installation
|
---|
| 77 | CD /D "%~dp0"
|
---|
[22526] | 78 |
|
---|
[22530] | 79 | :findPerl
|
---|
[19336] | 80 | :: Now need to find Perl. If found, PERLPATH will be set
|
---|
| 81 | call findperl.bat
|
---|
[5824] | 82 | if "%PERLPATH%" == "" goto exit
|
---|
[19336] | 83 |
|
---|
| 84 | :: Need to find Java. If found, JAVA_EXECUTABLE will be set
|
---|
| 85 | call findjava.bat
|
---|
[5824] | 86 | if "%JAVA_EXECUTABLE%" == "" goto exit
|
---|
| 87 |
|
---|
| 88 |
|
---|
| 89 | :checkGLI
|
---|
| 90 | :: ---- Check that the GLI has been compiled ----
|
---|
| 91 | if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
|
---|
| 92 | if exist "GLI.jar" goto runGLI
|
---|
[6749] | 93 | echo.
|
---|
| 94 | if "%GLILANG%" == "en" echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
|
---|
| 95 | if "%GLILANG%" == "en" echo before running this script.
|
---|
[6753] | 96 |
|
---|
| 97 | if "%GLILANG%" == "es" echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone
|
---|
| 98 | if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este gui¢n.
|
---|
[10787] | 99 |
|
---|
[6749] | 100 | if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
|
---|
[6754] | 101 | if "%GLILANG%" == "fr" echo avant d'excuter ce script.
|
---|
| 102 |
|
---|
| 103 | if "%GLILANG%" == "ru" echo ë €®«Šë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥çë© šâ¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
|
---|
[5824] | 104 | if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â
|
---|
| 105 | goto exit
|
---|
| 106 |
|
---|
| 107 |
|
---|
[17671] | 108 | :runGLI
|
---|
[17332] | 109 |
|
---|
[22409] | 110 | if not "%_VERSION%" == "" (
|
---|
| 111 | echo Greenstone Major Version :
|
---|
[17332] | 112 | echo %_VERSION%
|
---|
| 113 | echo.
|
---|
[7680] | 114 | )
|
---|
[17332] | 115 |
|
---|
| 116 | if not "%GSDL3SRCHOME%" == "" (
|
---|
[24829] | 117 | echo GSDL3SRCHOME:
|
---|
[17332] | 118 | echo !GSDL3SRCHOME!
|
---|
| 119 | echo.
|
---|
| 120 | )
|
---|
| 121 |
|
---|
| 122 | if not "%GSDL3HOME%" == "" (
|
---|
[24829] | 123 | echo GSDL3HOME:
|
---|
[17332] | 124 | echo !GSDL3HOME!
|
---|
| 125 | echo.
|
---|
| 126 | )
|
---|
| 127 |
|
---|
| 128 | if not "%GSDLHOME%" == "" (
|
---|
[24829] | 129 | echo GSDLHOME:
|
---|
[17332] | 130 | echo !GSDLHOME!
|
---|
| 131 | echo.
|
---|
| 132 | )
|
---|
[17671] | 133 |
|
---|
| 134 | :: ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ----
|
---|
| 135 | echo.
|
---|
| 136 | 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.
|
---|
| 137 | echo.
|
---|
| 138 | echo.
|
---|
| 139 | 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.
|
---|
| 140 | echo.
|
---|
| 141 | echo.
|
---|
| 142 |
|
---|
| 143 |
|
---|
[15629] | 144 | :: ---- Finally, run the GLI ----
|
---|
| 145 | if "%GLILANG%" == "en" echo Running the %PROGNAME%...
|
---|
| 146 | if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
|
---|
[16548] | 147 | if "%GLILANG%" == "fr" echo Excution de %PROGNAME%
|
---|
[5824] | 148 | if "%GLILANG%" == "ru" echo ¥ªãéš© ¡š¡«š %PROGNAME%...
|
---|
| 149 |
|
---|
| 150 | :: -Xms32M To set minimum memory
|
---|
| 151 | :: -Xmx32M To set maximum memory
|
---|
| 152 | :: -verbose:gc To set garbage collection messages
|
---|
| 153 | :: -Xincgc For incremental garbage collection
|
---|
| 154 | :: -Xprof Function call profiling
|
---|
| 155 | :: -Xloggc:<file> Write garbage collection log
|
---|
[12695] | 156 |
|
---|
[15608] | 157 |
|
---|
[19390] | 158 | :: Run GS3 if version = 3
|
---|
[15608] | 159 | 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
|
---|
| 160 | if "%_VERSION%" == "3" goto finRun
|
---|
| 161 |
|
---|
| 162 | :: Run GS2 since version is 2:
|
---|
| 163 | :: if FLI is running, we don't want the local Greenstone library server running
|
---|
[22575] | 164 | if "%PROGABBR%" == "FLI" goto webLib
|
---|
| 165 | :: 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] | 166 | if not exist "%GSDLHOME%\server.exe" if not exist "%GSDLHOME%\gs2-web-server.bat" goto webLib
|
---|
[20479] | 167 |
|
---|
| 168 | :localLib
|
---|
[24829] | 169 | if exist "%GSDLHOME%\server.exe" (
|
---|
[20479] | 170 | set locallib=!GSDLHOME!\server.exe
|
---|
[24829] | 171 | ) else (
|
---|
[17474] | 172 | set locallib=!GSDLHOME!\gs2-web-server.bat
|
---|
[12689] | 173 | )
|
---|
[20479] | 174 |
|
---|
[18408] | 175 | "%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
|
---|
| 176 | if ERRORLEVEL 2 (
|
---|
[17474] | 177 | goto localLib
|
---|
[15608] | 178 | )
|
---|
[12689] | 179 | goto finRun
|
---|
[20479] | 180 |
|
---|
| 181 | :webLib
|
---|
| 182 | "%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
|
---|
| 183 | if ERRORLEVEL 2 (
|
---|
| 184 | goto webLib
|
---|
| 185 | )
|
---|
[15608] | 186 | goto finRun
|
---|
| 187 |
|
---|
[22409] | 188 | :finRun
|
---|
| 189 | if "%GLILANG%" == "en" echo Done.
|
---|
| 190 | if "%GLILANG%" == "es" echo Hecho.
|
---|
| 191 | if "%GLILANG%" == "fr" echo Termin.
|
---|
[5927] | 192 | if "%GLILANG%" == "ru" echo 믮«¥®.
|
---|
[5824] | 193 | goto done
|
---|
[15608] | 194 |
|
---|
[5824] | 195 |
|
---|
| 196 | :exit
|
---|
| 197 | echo.
|
---|
[17942] | 198 | pause
|
---|
[23650] | 199 | color 07
|
---|
[5824] | 200 | rem popd
|
---|
[5927] | 201 |
|
---|
[5824] | 202 | :done
|
---|
| 203 | :: ---- Clean up ----
|
---|
[17501] | 204 | set PERLPATH=
|
---|
[19388] | 205 | set JAVA_EXECUTABLE=
|
---|
| 206 | set GLIMODE=
|
---|
| 207 | set PROGNAME=
|
---|
| 208 | set PROGNAME_EN=
|
---|
| 209 | set PROGFULLNAME=
|
---|
[17942] | 210 | set PROGABBR=
|
---|
[23650] | 211 | color 07
|
---|
| 212 | rem popd
|
---|
| 213 | cd "%startdir%"
|
---|
[24829] | 214 | set startdir=
|
---|
| 215 |
|
---|
| 216 | endlocal
|
---|