source: main/trunk/gli/findgsdl.bat@ 31703

Last change on this file since 31703 was 25678, checked in by davidb, 9 years ago

Added svn:executable property

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