@echo off set testdone=0 set target=%1 set configfile=%2 set MONITOR_SUCCESS="MAKE SUCCESSFUL" set MONITOR_FAILED="MAKE FAILED" set MONITOR_FINISHED="MAKE DONE" :: check that we have >=1 and <=2 arguments :chkargs if "%target%" == "" goto :usage if not "%3" == "" goto :usage goto begincmd :usage echo. echo Usage: %0 command echo where command is any of the following: ::echo web-start ::echo web-stop ::echo web-restart ::echo web-status ::echo web-graceful echo configure-admin echo configure-web [config-filename] echo configure-apache [config-filename] echo configure-cgi ::echo test-gsdlhome ::echo web-stop-tested echo. goto exit :begincmd :: web-stop-tested command assumes GSDLHOME/greenstone environment is already set if "%target%" == "web-stop-tested" goto stoptest :: For all other commands, the greenstone environment needs to be set first before they can be run :testgsdl if NOT "%GSDLHOME%" == "" goto commands echo. echo Environment variable GSDLHOME not set. echo This needs to be set to run the gsicontrol command %target%. echo Have you run setup.bat? echo. goto exit ::MAIN MENU :commands if "%target%" == "web-start" goto start if "%target%" == "web-stop" goto stop if "%target%" == "web-restart" goto restart if "%target%" == "web-status" goto status if "%target%" == "web-graceful" goto graceful if "%target%" == "configure-admin" goto cfgadmin if "%target%" == "configure-web" goto cfgweb if "%target%" == "configure-apache" goto cfgapach if "%target%" == "configure-cgi" goto cfgcgi if "%target%" == "test-gsdlhome" goto testgsdl :: unknown command goto usage :start :stop :restart :status :graceful :stoptest echo Command %target% is not yet operational (no local apache web server included in this release). goto exit rem :stoptest rem if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\apache-httpd\%GSDLOS%\bin\apachectl" stop rem goto exit ::configure-web ::configure-cgi :cfgweb :cfgcgi if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo WARNING: Nothing done for make configure-cgi. if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo If you wish to regenerate the file if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo %GSDLHOME%\cgi-bin\gsdlsite.cfg if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo from scratch, delete the existing file first. if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" goto cgifin echo Configuring cgi-bin\gsdlsite.cfg set gsdlpath=%GSDLHOME% for /F "delims=*" %%T in ('"echo %gsdlpath%| bin\windows\sed.exe s@\\@\\\\@g"') do set safepath=%%T bin\windows\sed.exe "s@\*\*GSDLHOME\*\*@\"%safepath%\"@g" cgi-bin/gsdlsite.cfg.in > cgi-bin/gsdlsite.cfg set gsdlpath= set safepath= :cgifin echo. if "%target%" == "configure-cgi" goto exit if "%target%" == "configure-web" goto cfgapach ::configure-apache :cfgapach if exist "%GSDLHOME%\llssite.cfg" goto :exit if not exist "%GSDLHOME%\llssite.cfg.in" goto :exit copy llssite.cfg.in llssite.cfg set configfile="%GSDLHOME%\llssite.cfg" goto exit ::configure-admin :cfgadmin echo. echo Configuring admin user password: for /F %%T in ('getpw') do set encrypted_password=%%T :: Have to create an intermediate file in the following, because echoing :: lines straight into a pipe adds spaces before the end of each line. :: When piping need to double escape angle brackets with three hat signs, :: but when redirecting to a file, need to escape only once (one hat sign). if ERRORLEVEL 0 ( ( echo [admin] echo ^true echo ^administrator,colbuilder,all-collections-editor echo ^%encrypted_password% echo ^admin ) > "%GSDLHOME%\etc\users.txt" type "%GSDLHOME%\etc\users.txt" | txt2db -append "%GSDLHOME%\etc\users.gdb" del "%GSDLHOME%\etc\users.txt" ) else ( echo Did not set password ) goto exit :exit set testdone= set target= set configfile= set MONITOR_SUCCESS= set MONITOR_FAILED= set MONITOR_FINISHED=