[24605] | 1 | @echo off
|
---|
[19388] | 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
|
---|
| 10 | echo.
|
---|
| 11 | if "%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 |
|
---|
| 18 | if "%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 trminos 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 |
|
---|
| 26 | if "%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 dtails, voir LICENSE.txt
|
---|
| 30 | echo Ceci est un logiciel libre, et vous tes invit
|
---|
| 31 | le redistribuer
|
---|
| 32 | )
|
---|
| 33 |
|
---|
| 34 | if "%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 |
|
---|
| 41 | echo.
|
---|
| 42 | :: ---- Determine path to Greenstone home for GS2 and GS3 ----
|
---|
| 43 | set GSDLPATH=
|
---|
| 44 | :: Some users may set the above line manually, or it may be set as an argument
|
---|
| 45 |
|
---|
| 46 | set _VERSION=
|
---|
| 47 | if 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
|
---|
| 57 | call gsdlver.bat %GSDLPATH% %_VERSION%
|
---|
| 58 | :: Stand-alone GLI with no Greenstone installation to be detected
|
---|
| 59 | :: otherwise
|
---|
| 60 | if "%_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
|
---|
| 68 | set _VERSION=3
|
---|
| 69 | set 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
|
---|
| 72 | if 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 | )
|
---|
| 79 | goto testGSDL
|
---|
| 80 |
|
---|
| 81 | :ver2
|
---|
| 82 | set _VERSION=2
|
---|
| 83 | set GSDLPATH=%GSDLHOME%
|
---|
| 84 | ::free up the GS3 environment variables since we are running GS2 and don't need them
|
---|
| 85 | set GSDL3SRCHOME=
|
---|
| 86 | set GSDL3HOME=
|
---|
| 87 | goto testGSDL
|
---|
| 88 |
|
---|
| 89 | :noVer
|
---|
| 90 | if "%GLIMODE%" == "local" if "%GLILANG%" == "en" echo Error: can't determine which Greenstone version is being run.
|
---|
| 91 | if "%GLIMODE%" == "client" if "%GLILANG%" == "en" echo Could not detect a Greenstone installation (no GSDLHOME).
|
---|
| 92 | goto exit
|
---|
| 93 |
|
---|
| 94 | :testGSDL
|
---|
| 95 | set CHECK=1
|
---|
| 96 | call chkinst.bat "%GSDLPATH%" %_VERSION% %GLILANG% %CHECK% > nul
|
---|
| 97 | if "%CHECK%" == "1" goto exit
|
---|
| 98 | :: otherwise installation worked well
|
---|
| 99 | goto prepGSDL
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 | :prepGSDL
|
---|
| 103 | :: Greenstone 3 case
|
---|
| 104 | if "%_VERSION%" == "3" goto prepGS3
|
---|
| 105 |
|
---|
| 106 | if not "%_VERSION%" == "2" echo "Greenstone version unknown"
|
---|
| 107 | if not "%_VERSION%" == "2" goto exit
|
---|
| 108 |
|
---|
| 109 | :: Otherwise, we are dealing with Greenstone 2
|
---|
| 110 | :: Setup Greenstone 2, unless it has already been done
|
---|
| 111 | if not "%GSDLHOME%" == "" goto doneGSDL
|
---|
| 112 | call "%GSDLPATH%\setup.bat" SetEnv
|
---|
| 113 | goto doneGSDL
|
---|
| 114 |
|
---|
| 115 |
|
---|
| 116 | :prepGS3
|
---|
| 117 | set GSDL2PATH=
|
---|
| 118 | :: Some users may set the above line manually
|
---|
| 119 |
|
---|
| 120 | if "%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
|
---|
| 152 | set CHECK=1
|
---|
| 153 | call chkinst.bat "%GSDL2PATH%" 2 %GLILANG% %CHECK% > nul
|
---|
| 154 | if "%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
|
---|
| 168 | set GSDLPATH=
|
---|
| 169 | set CHECK=
|
---|
| 170 | set GLIDIR= |
---|