source: gsdl/trunk/gsicontrol.bat@ 19288

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

Some changes to configure-admin target, not yet finished, not completely working.

File size: 3.7 KB
Line 
1@echo off
2
3set testdone=0
4set target=%1
5set configfile=%2
6
7set MONITOR_SUCCESS="MAKE SUCCESSFUL"
8set MONITOR_FAILED="MAKE FAILED"
9set MONITOR_FINISHED="MAKE DONE"
10
11:: check that we have >=1 and <=2 arguments
12:chkargs
13if "%target%" == "" goto :usage
14if not "%3" == "" goto :usage
15 goto begincmd
16
17
18:usage
19echo.
20echo Usage: %0 command
21echo where command is any of the following:
22::echo web-start
23::echo web-stop
24::echo web-restart
25::echo web-status
26::echo web-graceful
27echo configure-admin
28echo configure-web [config-filename]
29echo configure-apache [config-filename]
30echo configure-cgi
31::echo test-gsdlhome
32::echo web-stop-tested
33echo.
34goto exit
35
36
37:begincmd
38:: web-stop-tested command assumes GSDLHOME/greenstone environment is already set
39if "%target%" == "web-stop-tested" goto stoptest
40
41:: For all other commands, the greenstone environment needs to be set first before they can be run
42:testgsdl
43if NOT "%GSDLHOME%" == "" goto commands
44 echo.
45 echo Environment variable GSDLHOME not set.
46 echo This needs to be set to run the gsicontrol command %target%.
47 echo Have you run setup.bat?
48 echo.
49 goto exit
50
51
52::MAIN MENU
53:commands
54if "%target%" == "web-start" goto start
55if "%target%" == "web-stop" goto stop
56if "%target%" == "web-restart" goto restart
57if "%target%" == "web-status" goto status
58if "%target%" == "web-graceful" goto graceful
59if "%target%" == "configure-admin" goto cfgadmin
60if "%target%" == "configure-web" goto cfgweb
61if "%target%" == "configure-apache" goto cfgapach
62if "%target%" == "configure-cgi" goto cfgcgi
63if "%target%" == "test-gsdlhome" goto testgsdl
64 :: unknown command
65 goto usage
66
67:start
68:stop
69:restart
70:status
71:graceful
72:stoptest
73echo Command %target% is not yet operational (no local apache web server included in this release).
74goto exit
75
76rem :stoptest
77rem if exist "%GSDLHOME%\apache-httpd\%GSDLOS%\conf\httpd.conf" "%GSDLHOME%\apache-httpd\%GSDLOS%\bin\apachectl" stop
78rem goto exit
79
80::configure-web
81::configure-cgi
82:cfgweb
83:cfgcgi
84if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo WARNING: Nothing done for make configure-cgi.
85if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo If you wish to regenerate the file
86if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo %GSDLHOME%\cgi-bin\gsdlsite.cfg
87if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" echo from scratch, delete the existing file first.
88if exist "%GSDLHOME%\cgi-bin\gsdlsite.cfg" goto cgifin
89 echo Configuring cgi-bin\gsdlsite.cfg
90 set gsdlpath=%GSDLHOME%
91 for /F "delims=*" %%T in ('"echo %gsdlpath%| bin\windows\sed.exe s@\\@\\\\@g"') do set safepath=%%T
92 bin\windows\sed.exe "s@\*\*GSDLHOME\*\*@\"%safepath%\"@g" cgi-bin/gsdlsite.cfg.in > cgi-bin/gsdlsite.cfg
93 set gsdlpath=
94 set safepath=
95
96:cgifin
97echo.
98if "%target%" == "configure-cgi" goto exit
99if "%target%" == "configure-web" goto cfgapach
100
101::configure-apache
102:cfgapach
103if exist "%GSDLHOME%\llssite.cfg" goto :exit
104if not exist "%GSDLHOME%\llssite.cfg.in" goto :exit
105 copy llssite.cfg.in llssite.cfg
106 set configfile="%GSDLHOME%\llssite.cfg"
107 goto exit
108
109::configure-admin
110:cfgadmin
111echo.
112echo Configuring admin user password:
113for /F %%T in ('getpw') do set encrypted_password=%%T
114rem echo %encrypted_password%
115if ERRORLEVEL 0 (
116 (
117 echo [admin]
118 echo ^^^<enabled^^^>true
119 echo ^^^<groups^^^>administrator,colbuilder,all-collections-editor
120 echo ^^^<password^^^>%encrypted_password%
121 echo ^^^<username^^^>admin
122 )|txt2db -append "%GSDLHOME%\etc\users.gdb"
123) else (
124 echo Did not set password
125)
126goto exit
127
128
129:exit
130set testdone=
131set target=
132set configfile=
133set MONITOR_SUCCESS=
134set MONITOR_FAILED=
135set MONITOR_FINISHED=
Note: See TracBrowser for help on using the repository browser.