summaryrefslogtreecommitdiffstats
path: root/web_wizard/scripts
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-08-13 13:46:35 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-08-13 13:46:35 +0000
commit7766bee9c30f4a3580406846a8113c8786ecf1f5 (patch)
tree10eeb215efaea99b1106beb94c27af0fe20bbeb9 /web_wizard/scripts
parent148485ac164383aa702a68933e9cf796fbf0579b (diff)
downloaddrakwizard-7766bee9c30f4a3580406846a8113c8786ecf1f5.tar
drakwizard-7766bee9c30f4a3580406846a8113c8786ecf1f5.tar.gz
drakwizard-7766bee9c30f4a3580406846a8113c8786ecf1f5.tar.bz2
drakwizard-7766bee9c30f4a3580406846a8113c8786ecf1f5.tar.xz
drakwizard-7766bee9c30f4a3580406846a8113c8786ecf1f5.zip
use drakconnect db
Diffstat (limited to 'web_wizard/scripts')
-rw-r--r--web_wizard/scripts/Webconf.pm64
1 files changed, 22 insertions, 42 deletions
diff --git a/web_wizard/scripts/Webconf.pm b/web_wizard/scripts/Webconf.pm
index 69f99194..9be3a75e 100644
--- a/web_wizard/scripts/Webconf.pm
+++ b/web_wizard/scripts/Webconf.pm
@@ -2,61 +2,41 @@
package Webconf;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
+require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
+use MDK::Common;
use strict;
-my $that;
-my %mdk;
-my $device;
-my $s;
+my $o = DrakconnectConf->new();
-sub finish {
- my $old = "/etc/httpd/conf/commonhttpd.conf";
- my $new = "/tmp/commonhttpd.conf";
- my $bak = "/etc/httpd/conf/commonhttpd.conf.orig";
+sub check {
+ $> and return 1;
+ $o->is_dhcp() and return 2;
+ 0;
+}
- open(OLD, "< $old") or die "can't open $old: $!";
- open(NEW, "> $new") or die "can't open $new: $!";
+sub do_it {
+ my $file = "/etc/httpd/conf/commonhttpd.conf";
+ my $that = "localhost";
if ($ENV{wiz_web_external} eq "1") {
$that = "all";
}
elsif ($ENV{wiz_web_internal} eq "1") {
- $device = $mdk{wiz_device};
- %mdk = Vareqval->get("/etc/sysconfig/network-scripts/ifcfg-".$device);
- $that = "$mdk{IPADDR}";
- }
- else {
- $that = "localhost";
- }
-
- if ($ENV{wiz_web_external} eq "1") {
- my $that = "all";
- }
- elsif ($ENV{wiz_web_internal} eq "1") {
- %mdk = Vareqval->get("/etc/sysconfig/mdk_serv");
- defined $mdk{wiz_device} and $device = $mdk{wiz_device} or die "wiz_device not found in mdk_serv\n";
- %mdk = Vareqval->get("/etc/sysconfig/network-scripts/ifcfg-".$device);
- defined $mdk{IPADDR} and $that = $mdk{IPADDR} or die "IPADDR not found in /etc/sysconfig/network-scripts/ifcfg-xxx\n";
- }
- else {
- $that = "localhost";
- print "hello\n"
+ ($that) = $o->get_from_known_dev("IP") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/;
+ $that .= " localhost";
}
- while (<OLD>) {
- if( m /^[[:space:]]*<Directory \/home/s...m/^[[:space:]]*<\/Directory>/s ) {
- { s /^[[:space:]]*Allow .*$/ Allow from $that\n/s;}
+ 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 /^[[:space:]]*<Directory \/var\/www/s...m/^[[:space:]]*<\/Directory>/s ) {
- { s /^[[:space:]]*Allow .*$/ Allow from $that\n/s;}
+ if( m /^\s*<Directory \/var\/www/s...m/^\s*<\/Directory>/s ) {
+ { s /^\s*Allow .*$/ Allow from $that\n/s;}
;}
- print NEW $_ or die "can't write to $new: $!";
- }
- close(OLD) or die "can't close $old: $!";
- close(NEW) or die "can't close $new: $!";
-
- rename($old, $bak) or die "can't rename $old to $bak: $!";
- rename($new, $old) or die "can't rename $new to $old: $!";
+ } $file;
+ system("/etc/rc.d/init.d/httpd restart");
+ 10;
}
1;