diff options
-rw-r--r-- | web_wizard/scripts/Webconf.pm | 36 | ||||
-rw-r--r-- | web_wizard/web.wiz | 69 |
2 files changed, 101 insertions, 4 deletions
diff --git a/web_wizard/scripts/Webconf.pm b/web_wizard/scripts/Webconf.pm index 06a17fa5..cf9d9b55 100644 --- a/web_wizard/scripts/Webconf.pm +++ b/web_wizard/scripts/Webconf.pm @@ -15,6 +15,36 @@ sub check { 0; } +my $file = "/etc/httpd/conf/commonhttpd.conf"; +my $root; + +if (-f $file) { + open(FH, "< $file") or die "$! ($file)"; + while (<FH>) { + if (/^\s*\#?\s*DocumentRoot\s+(.*)/) { + close(FH); + $root = "$1"; + last; + } + } + close(FH); +} + +sub get_docroot { + $root; +} + +sub check_dir { + -d ($ENV{wiz_dir}) and return 10; + 1; +} + +sub chg_docroot { + substInFile { + s|(^\s*\#?\s*DocumentRoot\s*).*|$1$ENV{wiz_dir}|; + } "/etc/httpd/conf/commonhttpd.conf"; +} + sub do_it { my $file = "/etc/httpd/conf/commonhttpd.conf"; my $that = "localhost"; @@ -28,13 +58,11 @@ sub do_it { } cp_af($file, $file.".orig"); substInFile { - if( m /^\s*<Directory \/home/s...m/^\s*<\/Directory>/s ) { - { s /^\s*Allow .*$/ Allow from $that\n/s;} - ;} - if( m /^\s*<Directory \/var\/www/s...m/^\s*<\/Directory>/s ) { + if( m /^\s*<Directory.*>/s...m/^\s*<\/Directory>/s ) { { s /^\s*Allow .*$/ Allow from $that\n/s;} ;} } $file; +# chg_docroot(); system("/etc/rc.d/init.d/httpd restart"); 10; } diff --git a/web_wizard/web.wiz b/web_wizard/web.wiz index d5f15eb3..a4bea667 100644 --- a/web_wizard/web.wiz +++ b/web_wizard/web.wiz @@ -23,6 +23,12 @@ > </Variable> + <Variable + name="shared_dir" + shellVariable="wiz_dir" + > + </Variable> + <Page helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-web.html" name="welcome" @@ -149,6 +155,63 @@ </Page> <Page + helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" + name="ask_dir" + func="check_dir" + executionLevel="NORMAL" + nextFinish="false" + canBack="true" + canCancel="true" + > + + <Target + targetName="error_in_dir" + jumpIndex="1" + > + </Target> + + <Target + targetName="confirmation" + jumpIndex="10" + > + </Target> + + + <Info + helpText="Type the path of the directory you want being shared." + > + </Info> + + <Freetext + variableName="shared_dir" + helpText="Document Root:" + editable="true" + fillfunc="get_docroot" + > + </Freetext> + </Page> + + + <Page + helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" + name="error_in_dir" + jumpPage="ask_dir" + nextButtonText="Fix it" + executionLevel="NORMAL" + nextFinish="false" + canBack="true" + canCancel="true" + > + + <Info + helpText="The path you entered does not exist." + > + </Info> + </Page> + + + + <Page helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-web.html" name="confirmation" func="do_it" @@ -189,6 +252,12 @@ needed to configure your Web Server" > </Freetext> + <Freetext + variableName="shared_dir" + helpText="document root:" + editable="false" + > + </Freetext> <Info helpText="To accept these values, and configure your server, click the Next button or use the Back button to correct them." |