[8272] | 1 | @echo off
|
---|
[24828] | 2 | setlocal enabledelayedexpansion
|
---|
| 3 |
|
---|
[17943] | 4 | color 0A
|
---|
| 5 | pushd "%CD%"
|
---|
| 6 | CD /D "%~dp0"
|
---|
[8272] | 7 | set GLILANG=en
|
---|
| 8 |
|
---|
[24828] | 9 |
|
---|
[16548] | 10 | :: -------- Run the Greenstone Librarian Interface --------
|
---|
[8272] | 11 |
|
---|
| 12 | :: This script must be run from within the directory in which it lives
|
---|
[10788] | 13 | if exist gems.bat goto start
|
---|
[8272] | 14 | if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
|
---|
| 15 | if "%GLILANG%" == "es" echo Este gui¢n deber ejecutarse desde el directorio en el que reside.
|
---|
| 16 | if "%GLILANG%" == "fr" echo Ce script doit tre excut
|
---|
| 17 | partir du rpertoire dans lequel il se trouve.
|
---|
| 18 | if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ® à ᯮ«®Š¥
|
---|
| 19 | goto exit
|
---|
| 20 |
|
---|
[16548] | 21 | :start
|
---|
[8272] | 22 | if "%OS%" == "Windows_NT" goto progName
|
---|
[16548] | 23 | :: Invoke a new command processor to ensure there's enough environment space
|
---|
[8272] | 24 | if "%1" == "Second" goto progName
|
---|
[22531] | 25 | command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
[8272] | 26 | shift
|
---|
| 27 | goto done
|
---|
[16548] | 28 |
|
---|
| 29 |
|
---|
| 30 | :progName
|
---|
| 31 | if "%GLILANG%" == "es" set PROGNAME=Editar conjuntos de metadatos
|
---|
| 32 | if "%GLILANG%" == "fr" set PROGNAME=Editer les jeux de méta-données
|
---|
| 33 | if "%GLILANG%" == "ru" set PROGNAME=Ðåäàêòèðîâàòü íàáîðû ìåòàäàííûõ
|
---|
| 34 | :: if the PROGNAME is still not set, then set the language to English
|
---|
| 35 | if "%PROGNAME%" == "" set PROGNAME=Greenstone Editor for Metadata Sets
|
---|
| 36 |
|
---|
| 37 | if "%PROGABBR%" == "" set PROGABBR=GEMS
|
---|
| 38 | if "%PROGNAME_EN%" == "" set PROGNAME_EN=Greenstone Editor for Metadata Sets
|
---|
[22343] | 39 |
|
---|
[8272] | 40 | :: Now need to work out the _VERSION, GSDLHOME (and if GS3, then GSDL3SRCHOME and GSDL3HOME)
|
---|
[22343] | 41 | :findGSDL
|
---|
| 42 | call findgsdl.bat
|
---|
[8272] | 43 | if "%GSDLHOME%" == "" goto exit
|
---|
[22531] | 44 |
|
---|
[30568] | 45 | :checkUserPermissions
|
---|
[30573] | 46 |
|
---|
[30568] | 47 | rem In a web-dispersed GS3 setup like in the labs, we don't require the Greenstone directory to be writable.
|
---|
| 48 | rem If GS3, get the using.user.web property from build.properties and if set to true, we can skip to shiftElevated
|
---|
[30592] | 49 | :: http://ss64.com/nt/syntax-substring.html
|
---|
[30568] | 50 | if "%_VERSION%" == "3" if exist "%GSDL3SRCHOME%\build.properties" for /F "usebackq tokens=1,2 delims==" %%G in ("%GSDL3SRCHOME%\build.properties") do (
|
---|
| 51 | if "%%G" == "using.user.web" if "%%H" == "true" goto :shiftElevated
|
---|
| 52 | )
|
---|
[22575] | 53 |
|
---|
[22574] | 54 | echo.
|
---|
[24828] | 55 | echo Checking if the Greenstone collection directory is writable ...
|
---|
[22574] | 56 | (echo This is a temporary file. It is safe to delete it. > "!GSDLHOME!\collect\testing.tmp" ) 2>nul
|
---|
| 57 | if exist "%GSDLHOME%\collect\testing.tmp" goto deleteTempFile
|
---|
| 58 | if "%1" == "Elevated" goto printWarning
|
---|
[24828] | 59 | echo ... FAILED
|
---|
[22574] | 60 | echo The %PROGNAME% cannot write to the collection directory (!GSDLHOME!\collect)
|
---|
[22531] | 61 | echo Requesting elevated status to become admin user to continue.
|
---|
| 62 | "%GSDLHOME%\bin\windows\gstart.exe" %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
[22574] | 63 | goto done
|
---|
| 64 |
|
---|
| 65 | :printWarning
|
---|
[24828] | 66 | echo ... FAILED
|
---|
[22574] | 67 | echo The %PROGNAME% cannot write to the log directory (!GSDLHOME!\collect).
|
---|
| 68 | echo Attempting to continue without permissions.
|
---|
[22531] | 69 | goto shiftElevated
|
---|
| 70 |
|
---|
[22574] | 71 | :deleteTempFile
|
---|
| 72 | echo ... OK
|
---|
[22531] | 73 | del "%GSDLHOME%\collect\testing.tmp"
|
---|
| 74 |
|
---|
| 75 | :shiftElevated
|
---|
| 76 | :: Shift "Elevated" (one of our own internal command words) out of the way if present
|
---|
[22574] | 77 | :: so the command-line is as it was when the user initiated the command
|
---|
[22531] | 78 | if "%1" == "Elevated" shift
|
---|
[22343] | 79 |
|
---|
| 80 | :: Need to find Java. If found, JAVA_EXECUTABLE will be set
|
---|
| 81 | call findjava.bat
|
---|
[8272] | 82 | if "%JAVA_EXECUTABLE%" == "" goto exit
|
---|
| 83 |
|
---|
[16549] | 84 |
|
---|
[10788] | 85 | :chkGEMS
|
---|
[16548] | 86 | :: ---- Check that the GEMS has been compiled ----
|
---|
[10788] | 87 | if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGEMS
|
---|
[8272] | 88 | if exist "GLI.jar" goto runGEMS
|
---|
[16548] | 89 | echo.
|
---|
[8272] | 90 | if "%GLILANG%" == "en" echo You need to compile the %PROGNAME% (using makegli.bat)
|
---|
| 91 | if "%GLILANG%" == "en" echo before running this script.
|
---|
[16548] | 92 |
|
---|
[8272] | 93 | if "%GLILANG%" == "es" echo Usted necesita compilar la %PROGNAME%
|
---|
| 94 | if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este gui¢n.
|
---|
[16548] | 95 |
|
---|
| 96 | if "%GLILANG%" == "fr" echo Vous devez compiler le %PROGNAME% (en utilisant makegli.bat)
|
---|
[8272] | 97 | if "%GLILANG%" == "fr" echo avant d'excuter ce script.
|
---|
[16548] | 98 |
|
---|
[8272] | 99 | if "%GLILANG%" == "ru" echo ë €®«Šë ª®¬¯š«šà®¢ âì %PROGNAME% (šá¯®«ì§ãï makegli.bat)
|
---|
| 100 | if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â
|
---|
| 101 | goto exit
|
---|
| 102 |
|
---|
[10788] | 103 |
|
---|
[17862] | 104 | :runGEMS
|
---|
| 105 | if not "%_VERSION%" == "" (
|
---|
| 106 | echo Greenstone Major Version:
|
---|
| 107 | echo %_VERSION%
|
---|
| 108 | echo.
|
---|
| 109 | )
|
---|
| 110 |
|
---|
| 111 | if not "%GSDL3SRCHOME%" == "" (
|
---|
[24828] | 112 | echo GSDL3SRCHOME:
|
---|
[17862] | 113 | echo !GSDL3SRCHOME!
|
---|
| 114 | echo.
|
---|
| 115 | )
|
---|
| 116 |
|
---|
| 117 | if not "%GSDL3HOME%" == "" (
|
---|
[24828] | 118 | echo GSDL3HOME:
|
---|
[17862] | 119 | echo !GSDL3HOME!
|
---|
| 120 | echo.
|
---|
| 121 | )
|
---|
| 122 |
|
---|
| 123 | if not "%GSDLHOME%" == "" (
|
---|
[24828] | 124 | echo GSDLHOME:
|
---|
[17862] | 125 | echo !GSDLHOME!
|
---|
| 126 | echo.
|
---|
| 127 | )
|
---|
[17943] | 128 |
|
---|
[16548] | 129 | :: ---- Finally, run the GEMS ----
|
---|
| 130 | if "%GLILANG%" == "en" echo Running the %PROGNAME%...
|
---|
| 131 | if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
|
---|
| 132 | if "%GLILANG%" == "fr" echo Excution de %PROGNAME%
|
---|
| 133 | if "%GLILANG%" == "ru" echo ¥ªãéš© %PROGNAME%...
|
---|
[8272] | 134 |
|
---|
| 135 | :: -Xms32M To set minimum memory
|
---|
| 136 | :: -Xmx32M To set maximum memory
|
---|
| 137 | :: -verbose:gc To set garbage collection messages
|
---|
| 138 | :: -Xincgc For incremental garbage collection
|
---|
| 139 | :: -Xprof Function call profiling
|
---|
| 140 | :: -Xloggc:<file> Write garbage collection log
|
---|
| 141 |
|
---|
[16548] | 142 |
|
---|
[17943] | 143 | :: Run GS3 if version = 3
|
---|
[16548] | 144 | if "%_VERSION%" == "3" "%JAVA_EXECUTABLE%" -cp classes/;GLI.jar;lib/apache.jar org.greenstone.gatherer.gems.GEMS -gsdl3 %GSDL3HOME% %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
[8272] | 145 | if "%_VERSION%" == "3" goto finRun
|
---|
[16548] | 146 |
|
---|
[17943] | 147 | :: Else run GS2 since version is 2:
|
---|
[16548] | 148 | "%JAVA_EXECUTABLE%" -cp classes/;GLI.jar;lib/apache.jar org.greenstone.gatherer.gems.GEMS -gsdl %GSDLHOME% %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
| 149 |
|
---|
| 150 | :finRun
|
---|
| 151 | if "%GLILANG%" == "en" echo Done!
|
---|
| 152 | if "%GLILANG%" == "es" echo Hecho!
|
---|
| 153 | if "%GLILANG%" == "fr" echo Termin!
|
---|
| 154 | if "%GLILANG%" == "ru" echo 믮«¥®!
|
---|
| 155 | goto done
|
---|
| 156 |
|
---|
[8272] | 157 |
|
---|
| 158 | :exit
|
---|
| 159 | echo.
|
---|
[17943] | 160 | pause
|
---|
| 161 | color 07
|
---|
[8272] | 162 | popd
|
---|
| 163 | :done
|
---|
[17943] | 164 | :: ---- Clean up ----
|
---|
| 165 | set JAVAPATH=
|
---|
| 166 | set JAVA_EXECUTABLE=
|
---|
| 167 | color 07
|
---|
[24828] | 168 | popd
|
---|
| 169 |
|
---|
| 170 | endlocal
|
---|