[5824] | 1 | @echo off
|
---|
[17942] | 2 | color 0A
|
---|
[23650] | 3 | set startdir=%CD%
|
---|
| 4 | rem pushd "%CD%"
|
---|
[17942] | 5 | CD /D "%~dp0"
|
---|
[6749] | 6 | set GLILANG=en
|
---|
[5824] | 7 |
|
---|
[19388] | 8 | if "%GLIMODE%" == "" set GLIMODE=local
|
---|
[6749] | 9 |
|
---|
[5824] | 10 | :: -------- Run the Greenstone Librarian Interface --------
|
---|
| 11 |
|
---|
| 12 | :: This script must be run from within the directory in which it lives
|
---|
[22526] | 13 | if exist gli.bat goto start
|
---|
[6749] | 14 | if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
|
---|
[6753] | 15 | if "%GLILANG%" == "es" echo Este gui¢n deber ejecutarse desde el directorio en el que reside.
|
---|
[6749] | 16 | if "%GLILANG%" == "fr" echo Ce script doit tre excut
|
---|
[6754] | 17 | partir du rpertoire dans lequel il se trouve.
|
---|
[5824] | 18 | if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ® à ᯮ«®Š¥
|
---|
[22525] | 19 | goto exit
|
---|
[5824] | 20 |
|
---|
[15608] | 21 | :start
|
---|
[5824] | 22 | if "%OS%" == "Windows_NT" goto progName
|
---|
[15608] | 23 | :: Invoke a new command processor to ensure there's enough environment space
|
---|
[22530] | 24 | if "%1" == "Second" goto progName
|
---|
| 25 | command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
| 26 | shift
|
---|
[5824] | 27 | goto done
|
---|
[15608] | 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
|
---|
[19388] | 41 |
|
---|
[6669] | 42 | :: Now need to work out the _VERSION, GSDLHOME (and if GS3, then GSDL3SRCHOME and GSDL3HOME)
|
---|
[19388] | 43 | :findGSDL
|
---|
| 44 | call findgsdl.bat
|
---|
[6749] | 45 | if "%GSDLHOME%" == "" goto exit
|
---|
[22526] | 46 |
|
---|
[22575] | 47 | :checkUserPermissions
|
---|
[22574] | 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)
|
---|
[22530] | 55 | echo Requesting elevated status to become admin user to continue.
|
---|
[22526] | 56 | "%GSDLHOME%\bin\windows\gstart.exe" %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
[22574] | 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.
|
---|
[22530] | 63 | goto shiftElevated
|
---|
[22526] | 64 |
|
---|
[22574] | 65 | :deleteTempFile
|
---|
| 66 | echo ... OK
|
---|
[22526] | 67 | del "%GSDLHOME%\collect\testing.tmp"
|
---|
[22530] | 68 |
|
---|
| 69 | :shiftElevated
|
---|
| 70 | :: Shift "Elevated" (one of our own internal command words) out of the way if present
|
---|
[22574] | 71 | :: so the command-line is as it was when the user initiated the command
|
---|
[22530] | 72 | if "%1" == "Elevated" shift
|
---|
[23650] | 73 |
|
---|
| 74 | :: Make sure we're in the GLI folder, even if located outside a GS installation
|
---|
| 75 | CD /D "%~dp0"
|
---|
[22526] | 76 |
|
---|
[22530] | 77 | :findPerl
|
---|
[19336] | 78 | :: Now need to find Perl. If found, PERLPATH will be set
|
---|
| 79 | call findperl.bat
|
---|
[5824] | 80 | if "%PERLPATH%" == "" goto exit
|
---|
[19336] | 81 |
|
---|
| 82 | :: Need to find Java. If found, JAVA_EXECUTABLE will be set
|
---|
| 83 | call findjava.bat
|
---|
[5824] | 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
|
---|
[6749] | 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.
|
---|
[6753] | 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.
|
---|
[10787] | 97 |
|
---|
[6749] | 98 | if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
|
---|
[6754] | 99 | if "%GLILANG%" == "fr" echo avant d'excuter ce script.
|
---|
| 100 |
|
---|
| 101 | if "%GLILANG%" == "ru" echo ë €®«Šë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥çë© šâ¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
|
---|
[5824] | 102 | if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â
|
---|
| 103 | goto exit
|
---|
| 104 |
|
---|
| 105 |
|
---|
[17671] | 106 | :runGLI
|
---|
[17332] | 107 |
|
---|
[22409] | 108 | if not "%_VERSION%" == "" (
|
---|
| 109 | echo Greenstone Major Version :
|
---|
[17332] | 110 | echo %_VERSION%
|
---|
| 111 | echo.
|
---|
[7680] | 112 | )
|
---|
[17332] | 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 | )
|
---|
[17671] | 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 |
|
---|
[15629] | 142 | :: ---- Finally, run the GLI ----
|
---|
| 143 | if "%GLILANG%" == "en" echo Running the %PROGNAME%...
|
---|
| 144 | if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
|
---|
[16548] | 145 | if "%GLILANG%" == "fr" echo Excution de %PROGNAME%
|
---|
[5824] | 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
|
---|
[12695] | 154 |
|
---|
[15608] | 155 |
|
---|
[19390] | 156 | :: Run GS3 if version = 3
|
---|
[15608] | 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
|
---|
[22575] | 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)
|
---|
[15608] | 164 | if not exist "%GSDLHOME%\server.exe" if not exist "%GSDLHOME%\gs2-web-server.bat" goto webLib
|
---|
[20479] | 165 |
|
---|
| 166 | :localLib
|
---|
| 167 | if exist "%GSDLHOME%\server.exe" (
|
---|
| 168 | set locallib=%GSDLHOME%\server.exe
|
---|
[22575] | 169 | ) else (
|
---|
[17474] | 170 | set locallib=%GSDLHOME%\gs2-web-server.bat
|
---|
[12689] | 171 | )
|
---|
[20479] | 172 |
|
---|
[18408] | 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 (
|
---|
[17474] | 175 | goto localLib
|
---|
[15608] | 176 | )
|
---|
[12689] | 177 | goto finRun
|
---|
[20479] | 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 | )
|
---|
[15608] | 184 | goto finRun
|
---|
| 185 |
|
---|
[22409] | 186 | :finRun
|
---|
| 187 | if "%GLILANG%" == "en" echo Done.
|
---|
| 188 | if "%GLILANG%" == "es" echo Hecho.
|
---|
| 189 | if "%GLILANG%" == "fr" echo Termin.
|
---|
[5927] | 190 | if "%GLILANG%" == "ru" echo 믮«¥®.
|
---|
[5824] | 191 | goto done
|
---|
[15608] | 192 |
|
---|
[5824] | 193 |
|
---|
| 194 | :exit
|
---|
| 195 | echo.
|
---|
[17942] | 196 | pause
|
---|
[23650] | 197 | color 07
|
---|
[5824] | 198 | rem popd
|
---|
[5927] | 199 |
|
---|
[5824] | 200 | :done
|
---|
| 201 | :: ---- Clean up ----
|
---|
[17501] | 202 | set PERLPATH=
|
---|
[19388] | 203 | set JAVA_EXECUTABLE=
|
---|
| 204 | set GLIMODE=
|
---|
| 205 | set PROGNAME=
|
---|
| 206 | set PROGNAME_EN=
|
---|
| 207 | set PROGFULLNAME=
|
---|
[17942] | 208 | set PROGABBR=
|
---|
[23650] | 209 | color 07
|
---|
| 210 | rem popd
|
---|
| 211 | cd "%startdir%"
|
---|
| 212 | set startdir=
|
---|