[19278] | 1 | @echo off
|
---|
| 2 |
|
---|
[24829] | 3 | setlocal enabledelayedexpansion
|
---|
| 4 |
|
---|
[20262] | 5 | ::set testdone=0
|
---|
[23966] | 6 | set startdir=%CD%
|
---|
[23987] | 7 | cd /d "%~dp0"
|
---|
| 8 | ::we're now in the "%GSDLHOME%" folder
|
---|
| 9 | call setup.bat
|
---|
[23949] | 10 |
|
---|
[23966] | 11 | ::set _sed="%GSDLHOME%\bin\windows\sed.exe"
|
---|
| 12 | :: NOTE: no quotes allowed around the following, since it's used inside
|
---|
| 13 | :: a FOR statement executing a command already embedded in quotes
|
---|
| 14 | set _sed=bin\windows\sed.exe
|
---|
| 15 |
|
---|
[19278] | 16 | set target=%1
|
---|
| 17 | set configfile=%2
|
---|
[20906] | 18 | :: remove any quotes around configfile, if we were given parameter configfile
|
---|
| 19 | :: To test for the existence of a cmdline parameter: http://ss64.com/nt/if.html
|
---|
| 20 | if not [%2] == [] set configfile=%configfile:"=%
|
---|
[19278] | 21 |
|
---|
[20262] | 22 | :: Construct the signal using the unique GS2 installation
|
---|
[20906] | 23 | :: directory (after replacing spaces, colons and backslashes)
|
---|
| 24 | set signal=%GSDLHOME: =_%
|
---|
[24829] | 25 | for /F "delims=*" %%T in ('"echo !signal!| !_sed! s@[\\:]@_@g"') do set signal=%%T
|
---|
[20262] | 26 | set GS2_APACHE_HTTPD_SIGNAL=GS2_APACHE_HTTPD_%signal%
|
---|
[20906] | 27 | set signal=
|
---|
[20262] | 28 | rem echo Signal is: %GS2_APACHE_HTTPD_SIGNAL%
|
---|
| 29 |
|
---|
[19970] | 30 | :: Need to get greenstone installation directory
|
---|
| 31 | :: set cwd=%CD%
|
---|
[19278] | 32 |
|
---|
[19970] | 33 | set MONITOR_SUCCESS=MAKE SUCCESSFUL
|
---|
| 34 | set MONITOR_FAILED=MAKE FAILED
|
---|
| 35 | set MONITOR_FINISHED=MAKE DONE
|
---|
| 36 |
|
---|
[19278] | 37 | :: check that we have >=1 and <=2 arguments
|
---|
| 38 | :chkargs
|
---|
[20262] | 39 | if "%target%" == "" goto usage
|
---|
| 40 | if not "%3" == "" goto usage
|
---|
[19278] | 41 | goto begincmd
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | :usage
|
---|
| 45 | echo.
|
---|
| 46 | echo Usage: %0 command
|
---|
| 47 | echo where command is any of the following:
|
---|
[19970] | 48 | echo web-start
|
---|
| 49 | echo web-stop
|
---|
| 50 | echo web-restart
|
---|
[20262] | 51 | ::echo web-status
|
---|
| 52 | ::echo web-graceful
|
---|
[19278] | 53 | echo configure-admin
|
---|
| 54 | echo configure-web [config-filename]
|
---|
| 55 | echo configure-apache [config-filename]
|
---|
| 56 | echo configure-cgi
|
---|
[23945] | 57 | echo reset-gsdlhome [config-filename]
|
---|
[20637] | 58 | echo set-port
|
---|
[20262] | 59 | echo test-gsdlhome
|
---|
| 60 | echo web-stop-tested
|
---|
[19278] | 61 | echo.
|
---|
| 62 | goto exit
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | :begincmd
|
---|
| 66 | :: web-stop-tested command assumes GSDLHOME/greenstone environment is already set
|
---|
| 67 | if "%target%" == "web-stop-tested" goto stoptest
|
---|
| 68 |
|
---|
| 69 | :: For all other commands, the greenstone environment needs to be set first before they can be run
|
---|
| 70 | :testgsdl
|
---|
[20159] | 71 | if NOT "%GSDLHOME%" == "" if NOT "%GSDLOS%" == "" goto commands
|
---|
[20338] | 72 | echo.
|
---|
| 73 | echo Environment variable GSDLHOME (or GSDLOS) not set.
|
---|
| 74 | echo This needs to be set to run the gsicontrol command %target%.
|
---|
| 75 | echo Have you run setup.bat?
|
---|
| 76 | echo.
|
---|
| 77 | goto exit
|
---|
[19278] | 78 |
|
---|
| 79 |
|
---|
| 80 | ::MAIN MENU
|
---|
| 81 | :commands
|
---|
[20262] | 82 | echo.
|
---|
| 83 | echo Using:
|
---|
| 84 | echo GSDLHOME = %GSDLHOME%
|
---|
| 85 | echo GSDLOS = %GSDLOS%
|
---|
| 86 | echo.
|
---|
| 87 |
|
---|
[24902] | 88 | :: If %PROCESSOR_ARCHITECTURE% is x86, default the architecture to 32 bits, else 64.
|
---|
| 89 | :: (Can't test for x64, since the 64 bit Win 7 here returns "AMD64" instead of "x64".)
|
---|
| 90 | :: Then, if the svn version already uses just %GSDLOS% not %GSDLOS%%GSDLARCH%,
|
---|
| 91 | :: set GSDLARCH to the empty string. Same if %PROCESSOR_ARCHITECTURE% is empty.
|
---|
| 92 | if "%PROCESSOR_ARCHITECTURE%" == "x86" (set GSDLARCH=32) else (set GSDLARCH=64)
|
---|
| 93 | if "%PROCESSOR_ARCHITECTURE%" == "" set GSDLARCH=
|
---|
| 94 | if exist "bin\windows" set GSDLARCH=
|
---|
| 95 | set cgibin=cgi-bin\%GSDLOS%%GSDLARCH%
|
---|
| 96 | ::set cgibin=cgi-bin ::set cgibin=cgi-bin\windows
|
---|
[24874] | 97 |
|
---|
[19278] | 98 | if "%target%" == "web-start" goto start
|
---|
| 99 | if "%target%" == "web-stop" goto stop
|
---|
| 100 | if "%target%" == "web-restart" goto restart
|
---|
| 101 | if "%target%" == "configure-admin" goto cfgadmin
|
---|
| 102 | if "%target%" == "configure-web" goto cfgweb
|
---|
| 103 | if "%target%" == "configure-apache" goto cfgapach
|
---|
| 104 | if "%target%" == "configure-cgi" goto cfgcgi
|
---|
[23945] | 105 | if "%target%" == "reset-gsdlhome" goto resethome
|
---|
[20262] | 106 | :: already tested gsdlhome (and web-stop-tested) above, don't want to keep looping on it
|
---|
| 107 | if "%target%" == "test-gsdlhome" goto exit
|
---|
| 108 | rem if "%target%" == "web-stop-tested" goto exit
|
---|
[20338] | 109 | rem if "%target%" == "web-status" goto status
|
---|
| 110 | rem if "%target%" == "web-graceful" goto graceful
|
---|
| 111 | if "%target%" == "set-port" goto setport
|
---|
| 112 | :: unknown command
|
---|
| 113 | echo Command unrecognised: %target%
|
---|
| 114 | goto usage
|
---|
[19278] | 115 |
|
---|
[20338] | 116 |
|
---|
[19278] | 117 | :start
|
---|
[20159] | 118 | :: START starts the app in a new console named by the string following immediately thereafter
|
---|
| 119 | :: then we start up apache-httpd and pass the signal that the stop command will respond to
|
---|
[20262] | 120 | START "%GSDLHOME%\apachectl" "%GSDLHOME%\bin\windows\starthttpd.exe" %GS2_APACHE_HTTPD_SIGNAL% "%GSDLHOME%\apache-httpd\windows\bin\httpd.exe"
|
---|
[20639] | 121 | :: if the return value is >= 0, it's succeeded:
|
---|
| 122 | if ERRORLEVEL 0 (echo %MONITOR_SUCCESS%) else (echo %MONITOR_FAILED%)
|
---|
[19970] | 123 | echo %MONITOR_FINISHED%
|
---|
| 124 | goto exit
|
---|
| 125 |
|
---|
[19278] | 126 | :stop
|
---|
[20262] | 127 | :stoptest
|
---|
[20435] | 128 | if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" %GS2_APACHE_HTTPD_SIGNAL% SILENT
|
---|
[20262] | 129 | if "%target%" == "web-stop-tested" goto exit
|
---|
[20639] | 130 | :: if the return value is >= 0, it's succeeded:
|
---|
| 131 | if ERRORLEVEL 0 (echo %MONITOR_SUCCESS%) else (echo %MONITOR_FAILED%)
|
---|
[20262] | 132 | echo %MONITOR_FINISHED%
|
---|
[19970] | 133 | goto exit
|
---|
| 134 |
|
---|
[20637] | 135 |
|
---|
[19278] | 136 | :restart
|
---|
[20637] | 137 | :: Need to stop server, wait and start it again.
|
---|
| 138 | :: We're using Ping to implement batch file Wait
|
---|
[20262] | 139 | if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" %GS2_APACHE_HTTPD_SIGNAL%
|
---|
[20637] | 140 |
|
---|
| 141 | :: Wait 5 seconds and then start. See http://ss64.com/nt/sleep.html (and http://malektips.com/dos0017.html)
|
---|
| 142 | :: if loopback IP address (127.0.0.1) does not exist, we ask them to manually start it up again
|
---|
| 143 | ping -n 1 -w 1000 127.0.0.1 |find "TTL=">nul || goto failmsg
|
---|
| 144 | echo Waiting for re-start....
|
---|
| 145 | ping -n 5 -w 1000 127.0.0.1> nul
|
---|
[19970] | 146 | goto start
|
---|
| 147 |
|
---|
[20637] | 148 | :failmsg
|
---|
| 149 | echo Unable to wait for restart. Manually run %0 web-start
|
---|
| 150 | goto exit
|
---|
| 151 |
|
---|
| 152 |
|
---|
[20338] | 153 | ::status
|
---|
| 154 | ::graceful
|
---|
| 155 | ::echo Command %target% is not operational on this operating system
|
---|
| 156 | ::goto exit
|
---|
[19278] | 157 |
|
---|
| 158 |
|
---|
| 159 | ::configure-admin
|
---|
| 160 | :cfgadmin
|
---|
| 161 | echo.
|
---|
[19288] | 162 | echo Configuring admin user password:
|
---|
| 163 | for /F %%T in ('getpw') do set encrypted_password=%%T
|
---|
[19290] | 164 |
|
---|
| 165 | :: Have to create an intermediate file in the following, because echoing
|
---|
| 166 | :: lines straight into a pipe adds spaces before the end of each line.
|
---|
[19970] | 167 | :: When piping, need to double-escape the angle brackets with three hat signs,
|
---|
[19290] | 168 | :: but when redirecting to a file, need to escape only once (one hat sign).
|
---|
[19288] | 169 | if ERRORLEVEL 0 (
|
---|
| 170 | (
|
---|
| 171 | echo [admin]
|
---|
[19290] | 172 | echo ^<enabled^>true
|
---|
| 173 | echo ^<groups^>administrator,colbuilder,all-collections-editor
|
---|
[24829] | 174 | echo ^<password^>!encrypted_password!
|
---|
[19290] | 175 | echo ^<username^>admin
|
---|
[24829] | 176 | ) > "!GSDLHOME!\etc\users.txt"
|
---|
| 177 | type "!GSDLHOME!\etc\users.txt" | txt2db -append "!GSDLHOME!\etc\users.gdb"
|
---|
| 178 | del "!GSDLHOME!\etc\users.txt"
|
---|
[19288] | 179 | ) else (
|
---|
| 180 | echo Did not set password
|
---|
| 181 | )
|
---|
[20262] | 182 | echo.
|
---|
[19288] | 183 | goto exit
|
---|
[19278] | 184 |
|
---|
[20338] | 185 |
|
---|
[23974] | 186 | :: reset-gsdlhome forces configure-cgi by renaming any
|
---|
| 187 | :: existing gsdlsite.cfg and by deleting Mac .app files
|
---|
[24297] | 188 | :: However, we only relocate if there is a gsdlsite.cfg file with its gsdlhome
|
---|
| 189 | :: property the same as the current (greenstone installation) directory
|
---|
[23945] | 190 | :resethome
|
---|
| 191 | echo.
|
---|
[24297] | 192 | if not exist "%GSDLHOME%\%cgibin%\gsdlsite.cfg" goto relocate
|
---|
[23963] | 193 |
|
---|
[24765] | 194 | set gshome=
|
---|
[24829] | 195 | FOR /F "tokens=*" %%G IN ('findstr /R ^gsdlhome "!GSDLHOME!\!cgibin!\gsdlsite.cfg"') do call :concat %%G
|
---|
[24765] | 196 |
|
---|
| 197 | :: The following doesn't work if there are spaces in the gsdlhome filepath
|
---|
[24829] | 198 | ::FOR /F "tokens=2" %%G IN ('findstr /R ^gsdlhome "!GSDLHOME!\!cgibin!\gsdlsite.cfg"') do set gshome=%%G
|
---|
[24300] | 199 | :: before string comparison, remove any quotes around gsdlhome value defined in config file
|
---|
[24765] | 200 | :: if not [%gshome%] == [] set gshome=%gshome:"=%
|
---|
| 201 |
|
---|
[24300] | 202 | if "%gshome%" == "%GSDLHOME%" set gshome=& goto exit
|
---|
[24297] | 203 |
|
---|
| 204 | move "%GSDLHOME%\%cgibin%\gsdlsite.cfg" "%GSDLHOME%\%cgibin%\gsdlsite.cfg.bak"
|
---|
| 205 | echo **** Regenerating %GSDLHOME%\%cgibin%\gsdlsite.cfg
|
---|
| 206 | echo **** Previous version of file now %GSDLHOME%\%cgibin%\gsdlsite.cfg.bak
|
---|
[24786] | 207 |
|
---|
| 208 | :relocate
|
---|
[27521] | 209 | :: The path to the included perl at the top of gliserver.pl and other cgi-bin perl files needs to use the new gsdlhome
|
---|
| 210 | :: On windows, the path in gliserver.pl and the others uses backslashes
|
---|
[24829] | 211 | for /F "delims=*" %%T in ('"echo !gshome!| !_sed! s@\\@\\\\@g"') do set safeoldhome=%%T
|
---|
| 212 | for /F "delims=*" %%T in ('"echo !gsdlhome!| !_sed! s@\\@\\\\@g"') do set safenewhome=%%T
|
---|
[24819] | 213 | if exist "%GSDLHOME%\bin\%GSDLOS%\perl" (
|
---|
[24829] | 214 | copy "!cgibin!\gliserver.pl" "!cgibin!\gliserver.pl.bak"
|
---|
| 215 | type "!cgibin!\gliserver.pl.bak" | !_sed! "s@!safeoldhome!@!safenewhome!@g" > "!cgibin!\gliserver.pl"
|
---|
| 216 | del "!cgibin!\gliserver.pl.bak"
|
---|
[27521] | 217 |
|
---|
| 218 | copy "!cgibin!\metadata-server.pl" "!cgibin!\metadata-server.pl.bak"
|
---|
| 219 | type "!cgibin!\metadata-server.pl.bak" | !_sed! "s@!safeoldhome!@!safenewhome!@g" > "!cgibin!\metadata-server.pl"
|
---|
| 220 | del "!cgibin!\metadata-server.pl.bak"
|
---|
| 221 |
|
---|
| 222 | copy "!cgibin!\checksum.pl" "!cgibin!\checksum.pl.bak"
|
---|
| 223 | type "!cgibin!\checksum.pl.bak" | !_sed! "s@!safeoldhome!@!safenewhome!@g" > "!cgibin!\checksum.pl"
|
---|
| 224 | del "!cgibin!\checksum.pl.bak"
|
---|
[24819] | 225 | )
|
---|
[24786] | 226 | set safenewhome=
|
---|
| 227 | set safeoldhome=
|
---|
[24297] | 228 | set gshome=
|
---|
| 229 |
|
---|
[24829] | 230 | for /F "delims=*" %%T in ('"echo !GSDLHOME!| !_sed! s@\\@\/@g"') do set safepath=%%T
|
---|
[23963] | 231 |
|
---|
[23974] | 232 | :: Also re-initialise the log4j.properties and force regeneration of
|
---|
| 233 | :: Mac .app files since cfgweb will generate these if they don't exist
|
---|
[23966] | 234 | type "lib\java\log4j.properties.in" | %_sed% "s\@gsdl2home@\%safepath%\g" > "lib\java\log4j.properties"
|
---|
[24006] | 235 | :: No use for Mac .app files on Windows, so they're not there in Windows binaries including caveat
|
---|
| 236 | ::for %%G in (gs2-server.app gli.app client-gli.app gems.app) do if exist "%%G\Contents\document.wflow" del "%%G\Contents\document.wflow"
|
---|
[23945] | 237 | goto cfgweb
|
---|
| 238 |
|
---|
[24765] | 239 | :: Subroutine used to glue parts of a filepath that contains spaces back together again
|
---|
| 240 | :: http://www.computing.net/answers/programming/batch-for-loop-tokens/16727.html
|
---|
| 241 | :concat
|
---|
| 242 | :: first remove any quotes around this part of the filepath
|
---|
| 243 | set suffix=%~1
|
---|
[24904] | 244 | if not "%suffix%" == "gsdlhome" if not "%suffix%" == "collecthome" set gshome=%gshome%%suffix%
|
---|
[24765] | 245 | shift
|
---|
| 246 | if not "%~1"=="" goto concat
|
---|
| 247 | goto :eof
|
---|
[23963] | 248 |
|
---|
[24765] | 249 |
|
---|
[20338] | 250 | ::configure-web
|
---|
| 251 | ::configure-cgi
|
---|
| 252 | :cfgweb
|
---|
[23974] | 253 | :: first set up Mac's .app files if that's not already been done (if this is the first time we're running GS3)
|
---|
[24006] | 254 | :: No use for Mac .app files on Windows, so they're not there in Windows binaries including caveat
|
---|
| 255 | :: for %%G in (gs2-server.app gli.app client-gli.app gems.app) do if not exist "%%G\Contents\document.wflow" type "%%G\Contents\document.wflow.in" | %_sed% "s@\*\*GSDLHOME\*\*@%safepath%@g" > "%%G\Contents\document.wflow"
|
---|
[23974] | 256 |
|
---|
[20338] | 257 | :cfgcgi
|
---|
[24295] | 258 | :: Need to preserve the user-assigned collecthome property, if any
|
---|
[23949] | 259 | if exist "%GSDLHOME%\%cgibin%\gsdlsite.cfg" goto cgimsg
|
---|
| 260 | echo Configuring %cgibin%\gsdlsite.cfg
|
---|
[23987] | 261 | echo # **** This file is automatically generated, do not edit **** > "%cgibin%\gsdlsite.cfg"
|
---|
| 262 | echo # For local customization of Greenstone, edit gsdlsite.cfg.in >> "%cgibin%\gsdlsite.cfg"
|
---|
| 263 | echo. >> "%cgibin%\gsdlsite.cfg"
|
---|
[24295] | 264 |
|
---|
[24829] | 265 | for /F "delims=*" %%T in ('"echo !GSDLHOME!| !_sed! s@\\@\\\\@g"') do set safepath=%%T
|
---|
[23987] | 266 | %_sed% "s@\*\*GSDLHOME\*\*@\"%safepath%\"@g" "%cgibin%\gsdlsite.cfg.in" >> "%cgibin%\gsdlsite.cfg"
|
---|
[20338] | 267 | set safepath=
|
---|
[24295] | 268 |
|
---|
[20338] | 269 | goto cgifin
|
---|
| 270 |
|
---|
| 271 | :cgimsg
|
---|
| 272 | echo WARNING: Nothing done for configure-cgi.
|
---|
| 273 | echo If you wish to regenerate the file
|
---|
[23949] | 274 | echo %GSDLHOME%\%cgibin%\gsdlsite.cfg
|
---|
[20338] | 275 | echo from scratch, delete the existing file first.
|
---|
| 276 | echo.
|
---|
| 277 |
|
---|
| 278 | :cgifin
|
---|
| 279 | if "%target%" == "configure-cgi" goto exit
|
---|
| 280 | if "%target%" == "configure-web" goto cfgapach
|
---|
| 281 |
|
---|
| 282 | ::configure-apache
|
---|
| 283 | :cfgapach
|
---|
[24829] | 284 | if not "%configfile%" == "" if exist "%configfile%" (goto cfgport) else (echo Config file !configfile! does not exist. Using default llssite.cfg)
|
---|
[20338] | 285 |
|
---|
| 286 | if exist "%GSDLHOME%\llssite.cfg" (
|
---|
[24829] | 287 | set configfile=!GSDLHOME!\llssite.cfg
|
---|
[20338] | 288 | goto cfgport
|
---|
| 289 | )
|
---|
| 290 | if not exist "%GSDLHOME%\llssite.cfg.in" (
|
---|
[24829] | 291 | echo Unable to proceed as neither !GSDLHOME!\llssite.cfg nor !GSDLHOME!\llssite.cfg.in could be found
|
---|
[20338] | 292 | goto exit
|
---|
| 293 | )
|
---|
| 294 | copy "%GSDLHOME%\llssite.cfg.in" "%GSDLHOME%\llssite.cfg"
|
---|
[20906] | 295 | set configfile=%GSDLHOME%\llssite.cfg
|
---|
[20338] | 296 |
|
---|
| 297 | :cfgport
|
---|
| 298 | echo Configuring the apache webserver...
|
---|
| 299 | :: See http://ss64.com/nt/for_cmd.html, http://ss64.com/nt/findstr.html (and http://ss64.com/nt/find.html)
|
---|
[24829] | 300 | FOR /F "tokens=2 delims==" %%G IN ('findstr /R ^portnumber "!configfile!"') do set port=%%G
|
---|
| 301 | FOR /F "tokens=2 delims==" %%G IN ('findstr /R ^hostIP "!configfile!"') do set hostIP=%%G
|
---|
| 302 | FOR /F "tokens=2 delims==" %%G IN ('findstr /R ^hosts "!configfile!"') do set hosts=%%G
|
---|
| 303 | FOR /F "tokens=2 delims==" %%G IN ('findstr /R ^externalaccess "!configfile!"') do set allowfromall=%%G
|
---|
[20338] | 304 |
|
---|
[20637] | 305 | if "%allowfromall%" == "1" set allowfromall="Allow"& goto portcon
|
---|
| 306 | set allowfromall="Deny"
|
---|
[20615] | 307 |
|
---|
[20338] | 308 | :: Using CALL to jump to labels means we can return from them. BUT need to ensure
|
---|
| 309 | :: that command extensions are enabled to call labels. So just use GOTO instead.
|
---|
| 310 | ::http://ss64.com/nt/call.html
|
---|
| 311 | goto portcon
|
---|
| 312 |
|
---|
[20637] | 313 |
|
---|
[19970] | 314 | ::configure-port-and-connection
|
---|
[20338] | 315 | :setport
|
---|
[19970] | 316 | set /p port=Enter port number to use:
|
---|
[20637] | 317 | set /p hostIP=Enter host IP to allow (127.0.0.1 is included by default):
|
---|
[23252] | 318 | set /p hosts=Enter hostname or list of hosts to allow (localhost included by default):
|
---|
[20637] | 319 | set /p allowfromall=Allow external connections [yes/no]:
|
---|
[20338] | 320 |
|
---|
[20637] | 321 | if "%allowfromall%" == "yes" set allowfromall="Allow"& goto portcon
|
---|
| 322 | if "%allowfromall%" == "y" set allowfromall="Allow"& goto portcon
|
---|
| 323 | set allowfromall="Deny"
|
---|
[20615] | 324 | goto portcon
|
---|
| 325 |
|
---|
[20338] | 326 | :portcon
|
---|
| 327 | if "%port%" == "" (
|
---|
[20505] | 328 | echo Done
|
---|
| 329 | goto exit
|
---|
[20338] | 330 | )
|
---|
[24829] | 331 | if "%safepath%" == "" for /F "delims=*" %%T in ('"echo !GSDLHOME!| !_sed! s@\\@\/@g"') do set safepath=%%T
|
---|
[19970] | 332 |
|
---|
[24765] | 333 | :: Doesn't work if there are spaces in the collecthome path in gsdlsite.cfg
|
---|
[24829] | 334 | ::if exist "%GSDLHOME%\%cgibin%\gsdlsite.cfg" FOR /F "tokens=2" %%G IN ('findstr /R ^collecthome "!GSDLHOME!\!cgibin!\gsdlsite.cfg"') do set COLLECTHOME=%%G
|
---|
[24765] | 335 |
|
---|
| 336 | :: variable in subroutine concat is called gshome,
|
---|
| 337 | :: so forced to use it here for collecthome
|
---|
| 338 | set gshome=
|
---|
[24829] | 339 | if exist "%GSDLHOME%\%cgibin%\gsdlsite.cfg" FOR /F "tokens=*" %%G IN ('findstr /R ^collecthome "!GSDLHOME!\!cgibin!\gsdlsite.cfg"') do call :concat %%G
|
---|
[24765] | 340 | set COLLECTHOME=%gshome%
|
---|
| 341 | set gshome=
|
---|
| 342 |
|
---|
[22613] | 343 | if "%COLLECTHOME%" == "" set COLLECTHOME=%GSDLHOME%\collect
|
---|
[24829] | 344 | for /F "delims=*" %%T in ('"echo !COLLECTHOME!| !_sed! s@\\@\/@g"') do set safecollectpath=%%T
|
---|
[22613] | 345 |
|
---|
[20338] | 346 | echo Port: %port%
|
---|
| 347 | echo Stopping web server (if running)
|
---|
| 348 | if not exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" echo Missing conf file
|
---|
| 349 | if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\bin\windows\stophttpd.exe" %GS2_APACHE_HTTPD_SIGNAL% SILENT
|
---|
| 350 | echo Setting config file to use port %port%
|
---|
[24902] | 351 | type "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf.in" | %_sed% "s@\*\*GSDL_OS_ARCH\*\*@%GSDLOS%%GSDLARCH%@g" | %_sed% "s@\*\*PORT\*\*@%port%@g" | %_sed% "s@\*\*CONNECTPERMISSION\*\*@%allowfromall%@g" | %_sed% "s@\*\*HOST_IP\*\*@%hostIP%@g" | %_sed% "s@\*\*HOSTS\*\*@%hosts%@g" | %_sed% "s@\*\*COLLECTHOME\*\*@%safecollectpath%@g" | %_sed% "s@\*\*GSDLHOME\*\*@%safepath%@g" | %_sed% "s@\*\*APACHE_HOME_OS\*\*@%safepath%\/apache-httpd\/%GSDLOS%@g" > "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf"
|
---|
[20338] | 352 | echo Type '%0 web-start' to start the web server running on port %port%
|
---|
| 353 | echo Done
|
---|
[19970] | 354 |
|
---|
[20637] | 355 | set allowfromall=
|
---|
[20338] | 356 | set _sed=
|
---|
| 357 | set safepath=
|
---|
[20637] | 358 | set port=
|
---|
[20338] | 359 |
|
---|
| 360 | :: Extra processing for configure-web and configure-cgi command targets
|
---|
[20637] | 361 | if not "%target%" == "configure-web" if not "%target%" == "configure-cgi" goto exit
|
---|
[20338] | 362 | if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" (echo %MONITOR_SUCCESS%) else (echo %MONITOR_FAILED%)
|
---|
| 363 | echo %MONITOR_FINISHED%
|
---|
| 364 | goto exit
|
---|
| 365 |
|
---|
[19278] | 366 | :exit
|
---|
[23966] | 367 | cd "%startdir%"
|
---|
| 368 | set startdir=
|
---|
[19970] | 369 | endlocal
|
---|