source: gli/stable/findgsdl.bat@ 20753

Last change on this file since 20753 was 19388, checked in by ak19, 15 years ago

3 changes. 1. Moved GLI.bat's the finding and setting of GSDLHOME (and GSDL3SRCHOME and GSDL3HOME) into a separate batfile: findgsdl.bat. 2. This bat file is now called by both gli.bat and client-gli.bat, since client-bat can from now on use the same logice to locate a local GS installation. The only difference is that if GSDLHOME is not found, then client-gli runs as before: no Download panel. 3. Client-gli.bat will not look for a gs2build directory located inside a client-gli checkout, but instead search for a local GSDLHOME (including in the directory directly above, in case client-gli.bat is run from a normal GS checkout. IF a GSDLHOME is found (and perl too), then client-gli will enable the Download panel - using the local GSDLHOME to do the downloading.

File size: 5.6 KB
Line 
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
9echo.
10if "%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
17if "%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 t‚rminos 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
25if "%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 d‚tails, voir LICENSE.txt
29 echo Ceci est un logiciel libre, et vous ˆtes invit‚ …
30 le redistribuer
31 )
32
33if "%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
40echo.
41:: ---- Determine path to Greenstone home for GS2 and GS3 ----
42set GSDLPATH=
43:: Some users may set the above line manually, or it may be set as an argument
44
45set _VERSION=
46if 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
56call gsdlver.bat %GSDLPATH% %_VERSION%
57:: Stand-alone GLI with no Greenstone installation to be detected
58:: otherwise
59if "%_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
67set _VERSION=3
68set 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
71if 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 )
78goto testGSDL
79
80:ver2
81set _VERSION=2
82set GSDLPATH=%GSDLHOME%
83::free up the GS3 environment variables since we are running GS2 and don't need them
84set GSDL3SRCHOME=
85set GSDL3HOME=
86goto testGSDL
87
88:noVer
89if "%GLIMODE%" == "local" if "%GLILANG%" == "en" echo Error: can't determine which Greenstone version is being run.
90if "%GLIMODE%" == "client" if "%GLILANG%" == "en" echo Could not detect a Greenstone installation (no GSDLHOME).
91goto exit
92
93:testGSDL
94set CHECK=1
95call chkinst.bat "%GSDLPATH%" %_VERSION% %GLILANG% %CHECK% > nul
96if "%CHECK%" == "1" goto exit
97 :: otherwise installation worked well
98 goto prepGSDL
99
100
101:prepGSDL
102:: Greenstone 3 case
103if "%_VERSION%" == "3" goto prepGS3
104
105if not "%_VERSION%" == "2" echo "Greenstone version unknown"
106if not "%_VERSION%" == "2" goto exit
107
108:: Otherwise, we are dealing with Greenstone 2
109:: Setup Greenstone 2, unless it has already been done
110if not "%GSDLHOME%" == "" goto doneGSDL
111 call "%GSDLPATH%\setup.bat" SetEnv
112 goto doneGSDL
113
114
115:prepGS3
116set GSDL2PATH=
117:: Some users may set the above line manually
118
119if "%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
151set CHECK=1
152call chkinst.bat "%GSDL2PATH%" 2 %GLILANG% %CHECK% > nul
153if "%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
167set GSDLPATH=
168set CHECK=
169set GLIDIR=
Note: See TracBrowser for help on using the repository browser.