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