source: main/trunk/gli/gems.bat@ 30573

Last change on this file since 30573 was 30573, checked in by ak19, 8 years ago

Terminology change: 'web-distributed' GS3 is a GS3 with dispersed web folder (not 'distributed').

  • Property svn:executable set to *
File size: 5.6 KB
RevLine 
[8272]1@echo off
[24828]2setlocal enabledelayedexpansion
3
[17943]4color 0A
5pushd "%CD%"
6CD /D "%~dp0"
[8272]7set 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]13if 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 ex‚cut‚ …
17 partir du r‚pertoire dans lequel il se trouve.
18 if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥­ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ®­ à á¯®«®Š¥­
19 goto exit
20
[16548]21:start
[8272]22if "%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
31if "%GLILANG%" == "es" set PROGNAME=Editar conjuntos de metadatos
32if "%GLILANG%" == "fr" set PROGNAME=Editer les jeux de méta-données
33if "%GLILANG%" == "ru" set PROGNAME=Ðåäàêòèðîâàòü íàáîðû ìåòàäàííûõ
34:: if the PROGNAME is still not set, then set the language to English
35if "%PROGNAME%" == "" set PROGNAME=Greenstone Editor for Metadata Sets
36
37if "%PROGABBR%" == "" set PROGABBR=GEMS
38if "%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
42call findgsdl.bat
[8272]43if "%GSDLHOME%" == "" goto exit
[22531]44
[30568]45:checkUserPermissions
[30573]46
[30568]47rem In a web-dispersed GS3 setup like in the labs, we don't require the Greenstone directory to be writable.
48rem If GS3, get the using.user.web property from build.properties and if set to true, we can skip to shiftElevated
49:: http://ss64.com/nt/syntax-substring.html
50 if "%_VERSION%" == "3" if exist "%GSDL3SRCHOME%\build.properties" for /F "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
81call findjava.bat
[8272]82if "%JAVA_EXECUTABLE%" == "" goto exit
83
[16549]84
[10788]85:chkGEMS
[16548]86:: ---- Check that the GEMS has been compiled ----
[10788]87if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGEMS
[8272]88if 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'ex‚cuter 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
105if not "%_VERSION%" == "" (
106 echo Greenstone Major Version:
107 echo %_VERSION%
108 echo.
109)
110
111if not "%GSDL3SRCHOME%" == "" (
[24828]112 echo GSDL3SRCHOME:
[17862]113 echo !GSDL3SRCHOME!
114 echo.
115)
116
117if not "%GSDL3HOME%" == "" (
[24828]118 echo GSDL3HOME:
[17862]119 echo !GSDL3HOME!
120 echo.
121)
122
123if not "%GSDLHOME%" == "" (
[24828]124 echo GSDLHOME:
[17862]125 echo !GSDLHOME!
126 echo.
127)
[17943]128
[16548]129:: ---- Finally, run the GEMS ----
130if "%GLILANG%" == "en" echo Running the %PROGNAME%...
131if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
132if "%GLILANG%" == "fr" echo Ex‚cution de %PROGNAME%
133if "%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]144if "%_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]145if "%_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
159echo.
[17943]160pause
161color 07
[8272]162popd
163:done
[17943]164:: ---- Clean up ----
165set JAVAPATH=
166set JAVA_EXECUTABLE=
167color 07
[24828]168popd
169
170endlocal
Note: See TracBrowser for help on using the repository browser.