-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgs3-server.bat
62 lines (42 loc) · 1.97 KB
/
gs3-server.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@echo off
echo Greenstone 3 Server
echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
echo This software comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt
echo This is free software, and you are welcome to redistribute it
:: ---- Determine GSDL3HOME ----
:: Some users may set the above line manually
set GSDL3PATH=
:: The default location is the current directory
if "%GSDL3PATH%" == "" set GSDL3PATH=.
:: Setup Greenstone, unless it has already been done
if "%GSDL3SRCHOME%" == "" call "%GSDL3PATH%\gs3-setup.bat" SetEnv > nul
set USE_TMPDIR_FOR_TOMCAT=
for /F "usebackq tokens=1,2 delims==" %%G in ("%GSDL3SRCHOME%\build.properties") do (
if "%%G"=="gsdl3home.isreadonly" set USE_TMPDIR_FOR_TOMCAT=%%H
)
:: If the gsdl3.home readonly property is not already set to true, then
:: See if Greenstone3 web folder is writable
if "%USE_TMPDIR_FOR_TOMCAT%" == "false" (
echo.
echo Checking if the Greenstone3 web directory is writable ...
(echo This is a temporary file. It is safe to delete it. > "%GSDL3HOME%\testing.tmp" ) 2>nul
if exist "%GSDL3HOME%\testing.tmp" goto isWritable
)
:: Is read-only
set gsdl3_writablehome=%TMP%\greenstone\web
set opt_properties="-Dgsdl3home.isreadonly=true" -Dgsdl3.writablehome="%gsdl3_writablehome%"
if "%USE_TMPDIR_FOR_TOMCAT%" == "false" echo ... no.
echo Setting Greenstone3 web home writable area to be: %gsdl3_writablehome%
goto runJava
:isWritable
del "%GSDL3HOME%\testing.tmp"
set opt_properties="-Dgsdl3.writablehome=%GSDL3HOME%"
echo ... yes.
:runJava
:: Before running the Java program,
:: call ant target to initialize the gsdl3-writablehome area (if it doesn't already exist)
:: ... including the all important global.properties.
cmd /c ant.bat %opt_properties% configure-web
set GSDL3PATH=
set USE_TMPDIR_FOR_TOMCAT=
"%RUNJAVA%" -cp "%CLASSPATH%" %opt_properties% org.greenstone.server.Server3 "%GSDL3SRCHOME%"