1 | :: By the time this script is called by gli.bat, PROGNAME,
|
---|
2 | :: PROGABBR and GLILANG would be set.
|
---|
3 |
|
---|
4 | :: At the end of this script, GSDLHOME (and possibly GSDL3SRCHOME, GSDL3HOME)
|
---|
5 | :: will have been set if a local GS installation was found. If not found, then
|
---|
6 | :: GSDLHOME would not have been set.
|
---|
7 |
|
---|
8 | :findGSDL
|
---|
9 | echo.
|
---|
10 | if "%GLILANG%" == "en" (
|
---|
11 | echo %PROGNAME% ^(%PROGABBR%^)
|
---|
12 | echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato
|
---|
13 | echo %PROGABBR% comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt
|
---|
14 | echo This is free software, and you are welcome to redistribute it
|
---|
15 | )
|
---|
16 |
|
---|
17 | if "%GLILANG%" == "es" (
|
---|
18 | echo Interfaz de la %PROGNAME% ^(%PROGNAME_EN% - %PROGABBR%^)
|
---|
19 | echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato
|
---|
20 | echo La Interfaz de la %PROGNAME% NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÖA.
|
---|
21 | echo Para mayor informaci¢n vea los trminos de la licencia en LICENSE.txt
|
---|
22 | echo Este es un software abierto, por lo que lo invitamos a que lo distribuya de forma gratuita
|
---|
23 | )
|
---|
24 |
|
---|
25 | if "%GLILANG%" == "fr" (
|
---|
26 | echo Interface du %PROGNAME% ^(%PROGNAME_EN% - %PROGABBR%^)
|
---|
27 | echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato
|
---|
28 | echo %PROGABBR% est fourni sans AUCUNE GARANTIE; pour des dtails, voir LICENSE.txt
|
---|
29 | echo Ceci est un logiciel libre, et vous tes invit
|
---|
30 | le redistribuer
|
---|
31 | )
|
---|
32 |
|
---|
33 | if "%GLILANG%" == "ru" (
|
---|
34 | echo š¡«š®â¥çë© šâ¥à䥩á %PROGNAME% ^(%PROGNAME_EN% - %PROGABBR%^)
|
---|
35 | echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato
|
---|
36 | echo ¥ € ¥â ; €¥â «š á¬. ¢ ⥪á⥠LICENSE.TXT
|
---|
37 | echo â® - ᢮¡®€® à á¯à®áâà 塞®¥ ¯à®£à ¬¬®¥ ®¡¥á¯¥ç¥š¥ š ë ¬®Š¥â¥ à á¯à®áâà ïâì ¥£®
|
---|
38 | )
|
---|
39 |
|
---|
40 | echo.
|
---|
41 | :: ---- Determine path to Greenstone home for GS2 and GS3 ----
|
---|
42 | set GSDLPATH=
|
---|
43 | :: Some users may set the above line manually, or it may be set as an argument
|
---|
44 |
|
---|
45 | set _VERSION=
|
---|
46 | if not "%GSDLPATH%" == "" goto getVer
|
---|
47 | :: Otherwise gsdlpath is not yet set
|
---|
48 | :: Check the env vars first
|
---|
49 | if not "%GSDL3SRCHOME%" == "" goto ver3
|
---|
50 | if not "%GSDLHOME%" == "" goto ver2
|
---|
51 | :: If not set, the default location for the GLI is a subdirectory of Greenstone
|
---|
52 | set GSDLPATH=..
|
---|
53 | goto getVer
|
---|
54 |
|
---|
55 | :getVer
|
---|
56 | call gsdlver.bat %GSDLPATH% %_VERSION%
|
---|
57 | :: Stand-alone GLI with no Greenstone installation to be detected
|
---|
58 | :: otherwise
|
---|
59 | if "%_VERSION%" == "1" goto noVer
|
---|
60 | ::if we are running GS2, free up any pre-set GS3 environment variables since we won't need them
|
---|
61 | if "%_VERSION%" == "2" set GSDL3SRCHOME=
|
---|
62 | if "%_VERSION%" == "2" set GSDL3HOME=
|
---|
63 | goto testGSDL
|
---|
64 | :: else _VERSION is 3, we continue:
|
---|
65 |
|
---|
66 | :ver3
|
---|
67 | set _VERSION=3
|
---|
68 | set GSDLPATH=%GSDL3SRCHOME%
|
---|
69 | :: if GS2 is now also set, then both GS3 and GS2 are set:
|
---|
70 | :: warn the user that we have defaulted to GS3
|
---|
71 | if not "%GSDLHOME%" == "" (
|
---|
72 | echo Both Greenstone 2 and Greenstone 3 environments are set.
|
---|
73 | echo It is assumed you want to run Greenstone 3.
|
---|
74 | echo If you want to run Greenstone 2, please unset the
|
---|
75 | echo environment variable GSDL3SRCHOME before running GLI.
|
---|
76 | echo.
|
---|
77 | )
|
---|
78 | goto testGSDL
|
---|
79 |
|
---|
80 | :ver2
|
---|
81 | set _VERSION=2
|
---|
82 | set GSDLPATH=%GSDLHOME%
|
---|
83 | ::free up the GS3 environment variables since we are running GS2 and don't need them
|
---|
84 | set GSDL3SRCHOME=
|
---|
85 | set GSDL3HOME=
|
---|
86 | goto testGSDL
|
---|
87 |
|
---|
88 | :noVer
|
---|
89 | if "%GLIMODE%" == "local" if "%GLILANG%" == "en" echo Error: can't determine which Greenstone version is being run.
|
---|
90 | if "%GLIMODE%" == "client" if "%GLILANG%" == "en" echo Could not detect a Greenstone installation (no GSDLHOME).
|
---|
91 | goto exit
|
---|
92 |
|
---|
93 | :testGSDL
|
---|
94 | set CHECK=1
|
---|
95 | call chkinst.bat "%GSDLPATH%" %_VERSION% %GLILANG% %CHECK% > nul
|
---|
96 | if "%CHECK%" == "1" goto exit
|
---|
97 | :: otherwise installation worked well
|
---|
98 | goto prepGSDL
|
---|
99 |
|
---|
100 |
|
---|
101 | :prepGSDL
|
---|
102 | :: Greenstone 3 case
|
---|
103 | if "%_VERSION%" == "3" goto prepGS3
|
---|
104 |
|
---|
105 | if not "%_VERSION%" == "2" echo "Greenstone version unknown"
|
---|
106 | if not "%_VERSION%" == "2" goto exit
|
---|
107 |
|
---|
108 | :: Otherwise, we are dealing with Greenstone 2
|
---|
109 | :: Setup Greenstone 2, unless it has already been done
|
---|
110 | if not "%GSDLHOME%" == "" goto doneGSDL
|
---|
111 | call "%GSDLPATH%\setup.bat" SetEnv
|
---|
112 | goto doneGSDL
|
---|
113 |
|
---|
114 |
|
---|
115 | :prepGS3
|
---|
116 | set GSDL2PATH=
|
---|
117 | :: Some users may set the above line manually
|
---|
118 |
|
---|
119 | if "%GSDL3SRCHOME%" == "" goto setup3
|
---|
120 | if "%GSDL3HOME%" == "" goto setup3
|
---|
121 | ::otherwise
|
---|
122 | goto gs2build
|
---|
123 |
|
---|
124 |
|
---|
125 | :setup3
|
---|
126 | :: Setup Greenstone 3, unless it has already been done
|
---|
127 | cd | winutil\setvar.exe GLIDIR > %TMP%\setgli.bat
|
---|
128 | call %TMP%\setgli.bat
|
---|
129 | del %TMP%\setgli.bat
|
---|
130 | cd "%GSDLPATH%"
|
---|
131 | call gs3-setup.bat SetEnv
|
---|
132 | cd %GLIDIR%
|
---|
133 | goto gs2build
|
---|
134 |
|
---|
135 |
|
---|
136 | :gs2build
|
---|
137 | :: If Greenstone version 3 is running, we want to set gsdl2path
|
---|
138 | :: Determine GSDLHOME for GS3
|
---|
139 | if not "%GSDL2PATH%" == "" goto setupGS2
|
---|
140 | :: GSDL2PATH is not yet set.
|
---|
141 | :: And if GSDLHOME is not set either, then assume
|
---|
142 | :: that the gs2build subdir of GS3 exists
|
---|
143 | if "%GSDLHOME%" == "" set GSDL2PATH=%GSDL3SRCHOME%\gs2build
|
---|
144 | if "%GSDLHOME%" == "" goto setupGS2
|
---|
145 | :: Otherwise GSDLHOME is set, so set GSDL2PATH to GSDLHOME
|
---|
146 | echo GSDLHOME environment variable is set to %GSDLHOME%.
|
---|
147 | echo Will use this to find build scripts.
|
---|
148 | set GSDL2PATH=%GSDLHOME%
|
---|
149 |
|
---|
150 | :setupGS2
|
---|
151 | set CHECK=1
|
---|
152 | call chkinst.bat "%GSDL2PATH%" 2 %GLILANG% %CHECK% > nul
|
---|
153 | if "%CHECK%" == "1" goto exit
|
---|
154 | :: otherwise installation worked well
|
---|
155 | :: Setup Greenstone, unless it has already been done
|
---|
156 | if "%GSDLHOME%" == "" call "%GSDL2PATH%\setup.bat" SetEnv
|
---|
157 | :: Either way, we can now dispose of GSDL2PATH
|
---|
158 | set GSDL2PATH=
|
---|
159 | goto doneGSDL
|
---|
160 |
|
---|
161 |
|
---|
162 | :exit
|
---|
163 | :: if exit, then something went wrong. GSDLHOME would be empty already
|
---|
164 |
|
---|
165 | :doneGSDL
|
---|
166 | :: GSDLPATH is no longer needed, since GSDLHOME should now be set
|
---|
167 | set GSDLPATH=
|
---|
168 | set CHECK=
|
---|
169 | set GLIDIR= |
---|