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

Last change on this file since 30592 was 30592, checked in by ak19, 5 years ago

Further changes to make sure recent updates to batch scripts still protect spaces in filepath

  • Property svn:executable set to *
File size: 5.6 KB
Line 
1@echo off
2setlocal enabledelayedexpansion
3
4color 0A
5pushd "%CD%"
6CD /D "%~dp0"
7set GLILANG=en
8
9
10:: -------- Run the Greenstone Librarian Interface --------
11
12:: This script must be run from within the directory in which it lives
13if exist gems.bat goto start
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
21:start
22if "%OS%" == "Windows_NT" goto progName
23 :: Invoke a new command processor to ensure there's enough environment space
24 if "%1" == "Second" goto progName
25 command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
26 shift
27 goto done
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
39
40:: Now need to work out the _VERSION, GSDLHOME (and if GS3, then GSDL3SRCHOME and GSDL3HOME)
41:findGSDL
42call findgsdl.bat
43if "%GSDLHOME%" == "" goto exit
44
45:checkUserPermissions
46
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 "usebackq tokens=1,2 delims==" %%G in ("%GSDL3SRCHOME%\build.properties") do (
51 if "%%G" == "using.user.web" if "%%H" == "true" goto :shiftElevated
52 )
53
54 echo.
55 echo Checking if the Greenstone collection directory is writable ...
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
59 echo ... FAILED
60 echo The %PROGNAME% cannot write to the collection directory (!GSDLHOME!\collect)
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
63 goto done
64
65:printWarning
66 echo ... FAILED
67 echo The %PROGNAME% cannot write to the log directory (!GSDLHOME!\collect).
68 echo Attempting to continue without permissions.
69 goto shiftElevated
70
71:deleteTempFile
72 echo ... OK
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
77:: so the command-line is as it was when the user initiated the command
78 if "%1" == "Elevated" shift
79
80:: Need to find Java. If found, JAVA_EXECUTABLE will be set
81call findjava.bat
82if "%JAVA_EXECUTABLE%" == "" goto exit
83
84
85:chkGEMS
86:: ---- Check that the GEMS has been compiled ----
87if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGEMS
88if exist "GLI.jar" goto runGEMS
89 echo.
90 if "%GLILANG%" == "en" echo You need to compile the %PROGNAME% (using makegli.bat)
91 if "%GLILANG%" == "en" echo before running this script.
92
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.
95
96 if "%GLILANG%" == "fr" echo Vous devez compiler le %PROGNAME% (en utilisant makegli.bat)
97 if "%GLILANG%" == "fr" echo avant d'ex‚cuter ce script.
98
99 if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì %PROGNAME% (šá¯®«ì§ãï makegli.bat)
100 if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
101 goto exit
102
103
104:runGEMS
105if not "%_VERSION%" == "" (
106 echo Greenstone Major Version:
107 echo %_VERSION%
108 echo.
109)
110
111if not "%GSDL3SRCHOME%" == "" (
112 echo GSDL3SRCHOME:
113 echo !GSDL3SRCHOME!
114 echo.
115)
116
117if not "%GSDL3HOME%" == "" (
118 echo GSDL3HOME:
119 echo !GSDL3HOME!
120 echo.
121)
122
123if not "%GSDLHOME%" == "" (
124 echo GSDLHOME:
125 echo !GSDLHOME!
126 echo.
127)
128
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%...
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
142
143:: Run GS3 if version = 3
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
145if "%_VERSION%" == "3" goto finRun
146
147 :: Else run GS2 since version is 2:
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
157
158:exit
159echo.
160pause
161color 07
162popd
163:done
164:: ---- Clean up ----
165set JAVAPATH=
166set JAVA_EXECUTABLE=
167color 07
168popd
169
170endlocal
Note: See TracBrowser for help on using the repository browser.