summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-12-09 17:24:23 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-12-09 17:24:23 +0000
commit8f5aea5c59228ff4e71ba8951313d59fbfd99723 (patch)
tree2e42ca12d617f961c424ec55e3eb15f16667f6ab
parentcef4fffc8767d73ee93b8885a8615cbe5ef1b5d0 (diff)
downloaddrakwizard-8f5aea5c59228ff4e71ba8951313d59fbfd99723.tar
drakwizard-8f5aea5c59228ff4e71ba8951313d59fbfd99723.tar.gz
drakwizard-8f5aea5c59228ff4e71ba8951313d59fbfd99723.tar.bz2
drakwizard-8f5aea5c59228ff4e71ba8951313d59fbfd99723.tar.xz
drakwizard-8f5aea5c59228ff4e71ba8951313d59fbfd99723.zip
No more use of drakconnect_conf, use of IFCFG.pm instead of DrakconnectConf.pm
-rw-r--r--client_wizard/scripts/Clientconf.pm34
-rw-r--r--common/scripts/IFCFG.pm22
-rw-r--r--dhcp_wizard/scripts/Dhcpconf.pm17
-rw-r--r--dns_wizard/scripts/Dnsconf.pm20
-rwxr-xr-xdns_wizard/scripts/check_ext_dns.sh8
-rwxr-xr-xdrakwizard.pl48
-rw-r--r--ftp_wizard/ftp.wiz6
-rw-r--r--ftp_wizard/scripts/ProFtpconf.pm32
-rw-r--r--news_wizard/scripts/Newsconf.pm19
-rw-r--r--nfs_wizard/scripts/NFSConf.pm30
-rw-r--r--postfix_wizard/scripts/Postfixconf.pm9
-rw-r--r--proxy_wizard/scripts/Squidconf.pm29
-rwxr-xr-xsamba_wizard/scripts/Smbconf.pm56
-rw-r--r--time_wizard/scripts/NTPConf.pm1
-rw-r--r--web_wizard/scripts/Webconf.pm6
15 files changed, 215 insertions, 122 deletions
diff --git a/client_wizard/scripts/Clientconf.pm b/client_wizard/scripts/Clientconf.pm
index d7bceb64..3b480b3f 100644
--- a/client_wizard/scripts/Clientconf.pm
+++ b/client_wizard/scripts/Clientconf.pm
@@ -1,18 +1,36 @@
#!/usr/bin/perl
+# Drakwizard
+
+# Copyright (C) 2002 MandrakeSoft Arnaud Desmons <adesmons@mandrakesoft.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
package Clientconf;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
-require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
+require "__WIZ_HOME__/common/scripts/IFCFG.pm";
use MDK::Common;
use strict;
use standalone;
-my $o = DrakconnectConf->new();
-my $wiz_domain_name = $o->get("DomainName");
-my $wiz_ip_server = $o->get_from_known_dev("IP");
+my $o = IFCFG->new();
+my $wiz_domain_name = $o->network_get("DOMAINNAME");
+my $wiz_ip_server = $o->itf_get("IPADDR");
sub name {
- $o->get("SystemName");
+ $o->network_get("HOSTNAME");
}
sub ip {
@@ -36,9 +54,9 @@ sub get_root {
sub up_serial {
my ($file) = @_;
-
+
my $serial_nbm = `date +%Y%m%d00` or die "date not found: $!";
- output($file, map {
+ output($file, map {
my $line = $_;
if (/^(\s*)(\d*)(\s*;\s*Serial.*)$/) {
my $serial_f = $2;
@@ -76,7 +94,7 @@ sub do_it {
my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $ds = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $dc = "$4" if $ENV{wiz_client_ip} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
-
+
my $file="/var/named/$wiz_domain_name.db";
MDK::Common::cp_af($file, $file.".orig");
open(NEW, ">> $file") or die "can not open $file";
diff --git a/common/scripts/IFCFG.pm b/common/scripts/IFCFG.pm
index 00a98845..2d1171ba 100644
--- a/common/scripts/IFCFG.pm
+++ b/common/scripts/IFCFG.pm
@@ -23,11 +23,11 @@ use strict;
use Data::Dumper;
use MDK::Common;
-my $file = "/etc/sysconfig/network-scripts/drakconnect_conf";
-!-f $file and die "no such $file";
+#my $file = "/etc/sysconfig/network-scripts/drakconnect_conf";
+#!-f $file and die "no such $file";
sub new {
my $self = {};
-
+
$ENV{PATH} = "";
my $ifconfig = `LC_ALL=C /sbin/ifconfig -a`;
my $device = 'NONE';
@@ -42,7 +42,7 @@ sub new {
$self->{itf}{$device}{$_} = $conf{$_} foreach ('BOOTPROTO');
}
}
- $self->{network} = getVarsFromSh("/etc/sysconfig/network");
+ %{$self->{network}} = getVarsFromSh("/etc/sysconfig/network");
bless $self;
}
@@ -54,15 +54,6 @@ sub is_dhcp {
$self->{itf}{$itf}{BOOTPROTO} eq 'dhcp';
}
-
-sub get {
- my $self = shift;
- my ($key1, $key2) = @_;
-
- exists $self->{$key1}{$key2} or die "no $key1 $key2 field in $file";
- $self->{$key1}{$key2};
-}
-
#- TODO : return the main interface
sub default_itf {
"eth0";
@@ -73,7 +64,7 @@ sub itf_get {
my ($key, $itf) = @_;
$itf ||= default_itf;
- exists $self->{itf}{$itf}{$key} or die "no $key field in $file";
+ exists $self->{itf}{$itf}{$key} or die "no $key field in $itf hash";
$self->{itf}{$itf}{$key}
}
@@ -81,7 +72,8 @@ sub network_get {
my $self = shift;
my ($key) = @_;
- get("network", $key);
+ exists $self->{network}->{$key} or die "no $key field in network hash";
+ $self->{network}{$key};
}
10;
diff --git a/dhcp_wizard/scripts/Dhcpconf.pm b/dhcp_wizard/scripts/Dhcpconf.pm
index 4cb9a21a..d3504d5a 100644
--- a/dhcp_wizard/scripts/Dhcpconf.pm
+++ b/dhcp_wizard/scripts/Dhcpconf.pm
@@ -19,14 +19,14 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package Dhcpconf;
-require "__WIZ_HOME__/common/scripts/Vareqval.pm";
-require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
+require "__WIZ_HOME__/common/scripts/IFCFG.pm";
+#require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
use MDK::Common;
use strict;
use standalone;
-my $o = DrakconnectConf->new();
-my $wiz_ip_server = $o->get_from_known_dev("IP");
+my $o = IFCFG->new();
+my $wiz_ip_server = $o->itf_get("IPADDR");
my $d = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $s = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
@@ -48,7 +48,6 @@ sub compute_range2 {
sub check {
# FIXME : see check_range.sh
- my $wiz_ip_server = $o->get_from_known_dev("IP");
my $r1_trunc = "$1.$2.$3" if $ENV{wiz_ip_range1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $r2_trunc = "$1.$2.$3" if $ENV{wiz_ip_range2} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $d1 = "$4" if $ENV{wiz_ip_range1} =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
@@ -72,13 +71,13 @@ sub check_dhcp {
}
sub do_it {
- my $wiz_domain_name = $o->get("DomainName");
- my $wiz_host_name = $o->get("SystemName");
+ my $wiz_domain_name = $o->network_get("DOMAINNAME");
+ my $wiz_host_name = $o->network_get("HOSTNAME");
my $wiz_ip_net = "$1.$2.$3.0" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $wiz_ip_range1 = $ENV{wiz_ip_range1};
my $wiz_ip_range2 = $ENV{wiz_ip_range2};
- my $wiz_ip_netmask = $o->get_from_known_dev("Mask");
- my $wiz_device = $o->get_device();
+ my $wiz_ip_netmask = $o->itf_get("NETMASK");
+ my $wiz_device = $o->default_itf();
# patch to rewrite when got new file about dhcp with INTERFACES value
# currently, I put the device to configure as dhcp server
# in /etc/sysconfig/dhcpd
diff --git a/dns_wizard/scripts/Dnsconf.pm b/dns_wizard/scripts/Dnsconf.pm
index b03a6345..2c99cc1a 100644
--- a/dns_wizard/scripts/Dnsconf.pm
+++ b/dns_wizard/scripts/Dnsconf.pm
@@ -20,12 +20,12 @@
package Dnsconf;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
-require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
+require "__WIZ_HOME__/common/scripts/IFCFG.pm";
use MDK::Common;
use strict;
use standalone;
-my $o = DrakconnectConf->new();
+my $o = IFCFG->new();
my $dns1;
my $dns2;
@@ -67,7 +67,7 @@ sub get_dns2 {
sub up_serial {
my ($file) = @_;
-
+
my $serial_nbm = `date +%Y%m%d00` or die "date not found: $!";
output($file, map {
my $line = $_;
@@ -85,21 +85,21 @@ sub up_serial {
}
sub do_it {
- my $wiz_ip_server = $o->get_from_known_dev("IP");
- my $wiz_domain_name = $o->get("DomainName");
- my $wiz_host_name = $o->get("SystemName");
+ my $wiz_ip_server = $o->itf_get("IPADDR");
+ my $wiz_domain_name = $o->network_get("DOMAINNAME");
+ my $wiz_host_name = $o->network_get("HOSTNAME");
my $s_trunc = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $ds = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $host = "$1" if $wiz_host_name =~ /(.*?)\..*/;
my $reversnet = "$3$2$1" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $file = "/etc/host.conf";
-
+
MDK::Common::cp_af($file, $file.".orig");
MDK::Common::cp_af("__WIZ_HOME__/dns_wizard/scripts/host.conf.default", $file);
-
+
$file = "/etc/named.conf";
-f $file and MDK::Common::cp_af($file, $file.".orig");
-
+
my $ispns1 = $ENV{wiz_ext_dns1} || "// __ISPN1__";
my $ispns2 = $ENV{wiz_ext_dns2} || "// __ISPN2__";
@@ -130,7 +130,7 @@ sub do_it {
} cat_("__WIZ_HOME__/dns_wizard/scripts/127.0.0.rev.default"));
standalone::explanations("$file : hostname: $wiz_host_name");
up_serial($file);
-
+
# $ipnet.rev
$file = "/var/named/$s_trunc.rev";
-f $file and MDK::Common::cp_af($file, $file.".orig");
diff --git a/dns_wizard/scripts/check_ext_dns.sh b/dns_wizard/scripts/check_ext_dns.sh
index e62c55b7..e30ce409 100755
--- a/dns_wizard/scripts/check_ext_dns.sh
+++ b/dns_wizard/scripts/check_ext_dns.sh
@@ -32,8 +32,8 @@
if [ -n "${wiz_ext_dns1}" ]; then
a=${wiz_ext_dns1%%.*}
-b=`echo ${wiz_ext_dns1}|sed -n -e 's/^[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'`
-c=`echo ${wiz_ext_dns1}|sed -n -e 's/^[0-9]\{1,3\}\.[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'`
+b=`echo ${wiz_ext_dns1}|/bin/sed -n -e 's/^[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'`
+c=`echo ${wiz_ext_dns1}|/bin/sed -n -e 's/^[0-9]\{1,3\}\.[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'`
d=${wiz_ext_dns1##*.}
echo_debug "ip1 -$a-$b-$c-$d-"
@@ -54,8 +54,8 @@ fi
if [ -n "${wiz_ext_dns2}" ]; then
a=${wiz_ext_dns2%%.*}
-b=`echo ${wiz_ext_dns2}|sed -n -e 's/^[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'`
-c=`echo ${wiz_ext_dns2}|sed -n -e 's/^[0-9]\{1,3\}\.[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'`
+b=`echo ${wiz_ext_dns2}|/bin/sed -n -e 's/^[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'`
+c=`echo ${wiz_ext_dns2}|/bin/sed -n -e 's/^[0-9]\{1,3\}\.[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'`
d=${wiz_ext_dns2##*.}
echo_debug "ip2 -$a-$b-$c-$d-"
diff --git a/drakwizard.pl b/drakwizard.pl
index 0df835e8..866ea8a2 100755
--- a/drakwizard.pl
+++ b/drakwizard.pl
@@ -25,9 +25,7 @@ use vars qw($Wizard_title $Wizard_pix_up $lib_script $perl_module %variable $in
use XML::Parser;
use standalone;
use interactive;
-#use MDK::Common::Func;
use common;
-use Data::Dumper;
#- I18N.
push @::textdomains, 'drakwizard';
@@ -64,14 +62,14 @@ if (!defined($ARGV[0])) {
N("Please select a wizard"),
[{ val => \$ARGV[0], list => [sort keys %wiz], format => sub { $wiz{$_[0]}[1] }}]
);
- $ARGV[0] = $wiz{$ARGV[0]}[0];
+ $ARGV[0] = $wiz{$ARGV[0]}[0];
}
my $o = [];
my $o2 = [];
my $xmltree = XML::Parser->new(Style => 'Tree')->parsefile($ARGV[0]);
-local $_ = join '', @ARGV;
+local $_ = join '', @ARGV;
if (/-debug/) {
$::verbose = 1;
}
@@ -135,9 +133,9 @@ sub load_wizard {
sub map_freetext {
my @liste;
my $valeur;
-
+
my @data = map {
- my $toto = $_->{variableName};
+ my $str = $_->{variableName};
my $page = $_;
if ($_->{fillScript}) {
@@ -148,13 +146,13 @@ sub map_freetext {
$ENV{$variable{$_->{variableName}}} = $::{$perl_module_name."::"}{"$_->{fillfunc}"}->();
}
{ label => N($_->{helpText}),
- val => \$ENV{$variable{$_->{variableName}}}, type => $_->{main_order},
+ val => \$ENV{$variable{$_->{variableName}}}, type => $_->{main_order},
disabled => $disabled{$_->{variableName}},
help => $_->{help}}
}
elsif ($_->{main_order} eq 'field' && $_->{fillfunc}) {
{ label => N($_->{helpText}),
- val => $::{$perl_module_name."::"}{"$_->{fillfunc}"}->(), type => $_->{main_order},
+ val => $::{$perl_module_name."::"}{"$_->{fillfunc}"}->(), type => $_->{main_order},
disabled => $disabled{$_->{variableName}},
help => $_->{help}}
}
@@ -179,13 +177,13 @@ sub map_freetext {
#
map {
if (length($_)) {
- $disabled{$toto} = sub { callback($toto)};
+ $disabled{$str} = sub { callback($str)};
{ val => \$bool{$_},
label => "",
type => 'bool',
text => "$_",
help => "",
- disabled => $disabled{$toto}
+ disabled => $disabled{$str}
}
}
} @checklist;
@@ -219,7 +217,7 @@ sub map_freetext {
list => [@liste], type => $_->{main_order},
disabled => $disabled{$_->{variableName}} }}
elsif ($_->{main_order} eq 'field') {
- { val => $description{$ENV{$variable{$_->{variableName}}}}?
+ { val => $description{$ENV{$variable{$_->{variableName}}}} ?
$description{$ENV{$variable{$_->{variableName}}}} :
$ENV{$variable{$_->{variableName}}},
label => $_->{helpText},
@@ -230,7 +228,7 @@ sub map_freetext {
sub get_parameter {
my ($o, $tree, $tag ,$page) = @_;
-
+
foreach my $leaf (@$tree) {
if (ref($leaf) eq 'ARRAY') {
$page = get_parameter($o, $leaf, $tag, $page);
@@ -267,11 +265,11 @@ sub get_parameter {
$page->{info} = xml_text($leaf->{helpText} ?
"$page->{info}\n$leaf->{helpText}" : "$page->{info}\n");
$page->{info} = c::from_utf8($page->{info});
- $page->{info} .= translate(`source $lib_script; $leaf->{fillScript}`) if
+ $page->{info} .= translate(`source $lib_script; $leaf->{fillScript}`) if
($leaf->{fillScript})
},
- Freetext => $common_freetext_chooser = sub {
- my $main_order = ($tag eq 'Chooser') ? 'combo'
+ Freetext => $common_freetext_chooser = sub {
+ my $main_order = ($tag eq 'Chooser') ? 'combo'
: ($tag eq 'Boolean') ? 'bool'
: ($leaf->{editable} eq 'true') ? 'entry'
: 'field';
@@ -304,7 +302,7 @@ sub find_page {
sub display {
my ($o, $page) = @_;
my $data;
-
+
if ($page->{no_prev} || $page->{name} eq $welcome->{name}) {
$::Wizard_no_previous = 1;
}
@@ -346,7 +344,7 @@ sub display {
sub navigation {
my ($o, $page, $previous_page) = @_;
$page->{old_page} ||= $previous_page;
-
+
$current_page = $page;
display($o, $page);
my ($next, $prev) = do {
@@ -391,7 +389,7 @@ sub navigation {
sub is_disabled_summary {
my ($widget, $page) = @_;
-
+
if ($page->{is}) {
my ($page_val, $page_arg) = split(/\s*?=\s*/, $page->{is});
if ($page_val eq $widget) {
@@ -410,7 +408,7 @@ sub is_disabled_summary {
sub is_disabled {
my ($widget, $page) = @_;
my $ret;
-
+
foreach (@{$page->{freetext}}) {
if ($_->{is}) {
my ($val, $arg) = split(/\s*?=\s*/, $_->{is});
@@ -423,11 +421,11 @@ sub is_disabled {
sub callback_common {
return 1 if ($disabled{$_[0]} == 1);
foreach (keys %variable) {
- my $toto = $ENV{$variable{$_}};
- my $tata = $_;
+ my $str = $ENV{$variable{$_}};
+ my $str2 = $_;
foreach (keys %chooser_hash) {
- if ($toto eq $_) {
- $ENV{$variable{$tata}} = $chooser_hash{$_};
+ if ($str eq $_) {
+ $ENV{$variable{$str2}} = $chooser_hash{$_};
}
}
}
@@ -439,14 +437,14 @@ sub callback_summary {
is_disabled_summary($_[0], $o2->[0]);
}
-sub callback {
+sub callback {
return 1 if callback_common($_[0]);
is_disabled($_[0], $current_page);
}
sub get_summary {
my ($o, $tree, $tag, $page) = @_;
-
+
foreach my $leaf (@$tree) {
if (ref($leaf) eq 'ARRAY') {
$page = get_summary($o, $leaf, $tag, $page);
diff --git a/ftp_wizard/ftp.wiz b/ftp_wizard/ftp.wiz
index 63ad0024..df020c4f 100644
--- a/ftp_wizard/ftp.wiz
+++ b/ftp_wizard/ftp.wiz
@@ -35,7 +35,7 @@
>
</Variable>
<Variable
- name="shared_dir"
+ name="wiz_dir"
shellVariable="wiz_dir"
>
</Variable>
@@ -198,7 +198,7 @@
<Freetext
name="freetext_dir"
- variableName="shared_dir"
+ variableName="wiz_dir"
helpText="Shared dir:"
editable="true"
fillfunc="get_dir"
@@ -264,7 +264,7 @@ needed to configure your FTP Server"
</Freetext>
<Freetext
- variableName="shared_dir"
+ variableName="wiz_dir"
helpText="Public directory:"
editable="false"
>
diff --git a/ftp_wizard/scripts/ProFtpconf.pm b/ftp_wizard/scripts/ProFtpconf.pm
index 77877742..5db3c385 100644
--- a/ftp_wizard/scripts/ProFtpconf.pm
+++ b/ftp_wizard/scripts/ProFtpconf.pm
@@ -1,7 +1,25 @@
#!/usr/bin/perl
+# Drakwizard
+
+# Copyright (C) 2002 MandrakeSoft Arnaud Desmons (adesmons@mandrakesoft.com)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
package ProFtpconf;
-require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
+require "__WIZ_HOME__/common/scripts/IFCFG.pm";
use MDK::Common;
use strict;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
@@ -16,6 +34,9 @@ sub true {
}
sub check_dir {
+ foreach (keys %ENV) {
+ print "$_ $ENV{$_}\n";
+ }
-d ($ENV{wiz_dir}) and return 10;
1;
}
@@ -28,10 +49,10 @@ sub get_dir {
}
}
}
- "";
+ return "";
}
-my $o = DrakconnectConf->new();
+my $o = IFCFG->new();
sub check {
$> and return 1;
@@ -39,7 +60,7 @@ sub check {
0;
}
-sub print_anonymous() {
+sub print_anonymous() {
print '
#<drakwizard>
<Anonymous '.$_[0].'>
@@ -64,7 +85,7 @@ sub do_it {
open(NEW, "< $file") or die "error while opening $file: $!";
my $allow = "all";
if ($wiz_ftp_internal && !$wiz_ftp_external) {
- ($allow) = $o->get_from_known_dev("IP") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/;
+ ($allow) = $o->itf_get("IPADDR") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/;
$allow .= " 127.0.0.1";
}
elsif (!$wiz_ftp_external) {
@@ -139,4 +160,3 @@ sub do_it {
10;
}
1;
-
diff --git a/news_wizard/scripts/Newsconf.pm b/news_wizard/scripts/Newsconf.pm
index 55e99729..ddd99f6f 100644
--- a/news_wizard/scripts/Newsconf.pm
+++ b/news_wizard/scripts/Newsconf.pm
@@ -1,5 +1,24 @@
#!/usr/bin/perl
+# Drakwizard
+
+# Copyright (C) 2002 MandrakeSoft Arnaud Desmons <adesmons@mandrakesoft.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
package Newsconf;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
use MDK::Common;
diff --git a/nfs_wizard/scripts/NFSConf.pm b/nfs_wizard/scripts/NFSConf.pm
index 10387805..e21327bb 100644
--- a/nfs_wizard/scripts/NFSConf.pm
+++ b/nfs_wizard/scripts/NFSConf.pm
@@ -1,16 +1,34 @@
-#! /usr/bin/perl -w
+#!/usr/bin/perl
+
+# Drakwizard
+
+# Copyright (C) 2002 MandrakeSoft Arnaud Desmons (adesmons@mandrakesoft.com)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package NFSConf;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
-require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
+require "__WIZ_HOME__/common/scripts/IFCFG.pm";
use MDK::Common;
use strict;
-my $o = DrakconnectConf->new();
+my $o = IFCFG->new();
sub network_mask {
- my $wiz_ip_server = $o->get_from_known_dev("IP");
- my $mask = $o->get_from_known_dev("Mask");
+ my $wiz_ip_server = $o->itf_get("IPADDR");
+ my $mask = $o->itf_get("NETMASK");
$mask = $mask ? $mask : "255.255.255.0";
$wiz_ip_server = $wiz_ip_server ? $wiz_ip_server : "192.168.1.0";
"$1.$2.$3.0/$mask" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
@@ -26,7 +44,7 @@ sub do_it {
chomp($ENV{wiz_nfs_dir});
-f $file and cp_af($file, $file.".orig");
if ($ENV{wiz_nfs_level} == 2) {
- my $mask = $o->get_from_known_dev("Mask");
+ my $mask = $o->itf_get("NETMASK");
$line = "$ENV{wiz_nfs_dir} $ENV{wiz_netmask}(rw,no_root_squash)\n";
}
else {
diff --git a/postfix_wizard/scripts/Postfixconf.pm b/postfix_wizard/scripts/Postfixconf.pm
index cfa25fe5..176795ac 100644
--- a/postfix_wizard/scripts/Postfixconf.pm
+++ b/postfix_wizard/scripts/Postfixconf.pm
@@ -2,13 +2,13 @@
package Postfixconf;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
-require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
+require "__WIZ_HOME__/common/scripts/IFCFG.pm";
use MDK::Common;
use strict;
-my $o = DrakconnectConf->new();
-my $wiz_domain_name = $o->get("DomainName");
-my $wiz_host_name = $o->get("SystemName");
+my $o = IFCFG->new();
+my $wiz_domain_name = $o->network_get("DOMAINNAME");
+my $wiz_host_name = $o->network_get("HOSTNAME");
sub get_mail_masquerade {
my $login = `logname`;
@@ -28,7 +28,6 @@ sub get_mail_relay {
}
sub do_it {
- my $wiz_host_name = $o->get("SystemName");
my @conf = qw(/etc/postfix/aliases
/etc/postfix/canonical
/etc/postfix/main.cf
diff --git a/proxy_wizard/scripts/Squidconf.pm b/proxy_wizard/scripts/Squidconf.pm
index 3c343b8f..528d3ab4 100644
--- a/proxy_wizard/scripts/Squidconf.pm
+++ b/proxy_wizard/scripts/Squidconf.pm
@@ -1,17 +1,36 @@
#!/usr/bin/perl
+# Drakwizard
+
+# Copyright (C) 2002 MandrakeSoft Arnaud Desmons (adesmons@mandrakesoft.com)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
package Squidconf;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
require "__WIZ_HOME__/common/scripts/Varspaceval.pm";
-require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
+require "__WIZ_HOME__/common/scripts/IFCFG.pm";
use MDK::Common;
use strict;
use standalone;
sub network_mask {
- my $o = DrakconnectConf->new();
- my $wiz_ip_server = $o->get_from_known_dev("IP");
- my $mask = $o->get_from_known_dev("Mask");
+ my $o = IFCFG->new();
+ my $wiz_ip_server = $o->itf_get("IPADDR");
+ my $mask = $o->itf_get("NETMASK");
"$1.$2.$3.0/$mask" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
}
@@ -39,7 +58,6 @@ sub do_it_squid {
my $file="/etc/squid/squid.conf";
-f $file and MDK::Common::cp_af($file, $file.".orig");
MDK::Common::cp_af("__WIZ_HOME__/proxy_wizard/scripts/squid.conf.default", $file);
- print "$ENV{wiz_squid_defdir}\n";
substInFile {
s|^\s*\#?\s*(cache_dir.*$ENV{wiz_squid_defdir}\s*)\d*(.*)|$1$ENV{wiz_squid_disk}$2|;
s|^\s*\#?\s*(acl\s*mynetwork\s*src\s*).*$|$1$ENV{wiz_squid_mynetw}\n|;
@@ -49,7 +67,6 @@ sub do_it_squid {
standalone::explanations("$file: cache_dir = $ENV{wiz_squid_defdir} $ENV{wiz_squid_disk}
mynetw = $ENV{wiz_squid_mynetw} cache_mem = $ENV{wiz_squid_mem} http_port = $ENV{wiz_squid_port}
level = $ENV{wiz_squid_level}");
- print "$ENV{wiz_squid_level}\n";
if ($ENV{wiz_squid_level} == 1) {
substInFile {
s|^\s*\#?\s*(http_access\s*)deny(\s*all.*)|\#$&\n$1allow$2|;
diff --git a/samba_wizard/scripts/Smbconf.pm b/samba_wizard/scripts/Smbconf.pm
index 1d493c72..b44c61e9 100755
--- a/samba_wizard/scripts/Smbconf.pm
+++ b/samba_wizard/scripts/Smbconf.pm
@@ -1,10 +1,28 @@
-#! /usr/bin/perl -w
+#!/usr/bin/perl
+
+# Drakwizard
+
+# Copyright (C) 2002 MandrakeSoft Arnaud Desmons (adesmons@mandrakesoft.com)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package Smbconf;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
-require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
+require "__WIZ_HOME__/common/scripts/IFCFG.pm";
use MDK::Common;
-#use strict;
+use strict;
use Data::Dumper;
# All possibilies in the config file must be precedeed by ";"
@@ -12,7 +30,7 @@ use Data::Dumper;
# but can not add anything.
# so one variable cannot be commented and not in the same file.
-my $o = DrakconnectConf->new();
+my $o = IFCFG->new();
sub check {
$> and return 1;
@@ -41,7 +59,7 @@ sub read_conf {
my $menu;
my @tab;
my %conf;
-
+
open(FH, $file) or die "$! ($file)";
while (<FH>) {
if (/^(\s*\;?\s*)\[(.*)\].*/) {
@@ -65,7 +83,7 @@ sub write_conf {
my $self = shift;
my ($file) = @_;
my $menu;
-
+
open(FH, "> $file") or die "$!";
foreach (@{$self->{tab}}) {
if (/^\s*\;?\s*\[(.*)\].*/) {
@@ -85,7 +103,7 @@ sub write_conf {
sub add_printer {
my $self = shift;
my ($printer) = @_;
-
+
if (exists $self->{conf}->{$printer}) {
$self->comment_menu($printer, " ");
}
@@ -102,7 +120,7 @@ sub add_printer {
sub list_printers {
my @list if 0;
-
+
return @list if @list;
@list = sort grep /^(?!\#).*/, map {
my ($printer) = split(':', $_);
@@ -118,7 +136,7 @@ sub check_users {
sub comment_menu {
my $self = shift;
my ($menu, $str) = @_;
-
+
return if (!$menu or !exists $self->{conf}->{$menu});
$self->{conf}->{$menu}{__comment} = $str;
foreach (keys %{$self->{conf}->{$menu}}) {
@@ -130,35 +148,32 @@ sub comment_menu {
sub comment_var {
my $self = shift;
my ($menu, $var, $str) = @_;
-
+
$self->{conf}->{$menu}{$var}{comment} = $str;
}
sub chg_var {
my $self = shift;
my ($menu, $var, $str) = @_;
-
+
$self->{conf}->{$menu}{$var}{value} = $str;
}
# all or selected printers
sub printer_sharing {
my $self = shift;
- my $printer;
if ($ENV{wiz_all_printers}) {
$self->comment_menu("printers", " ");
- foreach $printer (keys (%::bool)) {
+ foreach my $printer (keys (%::bool)) {
$self->comment_menu($printer, ";");
}
}
else {
$self->comment_menu("printers", ";");
- foreach $printer (keys (%::bool)) {
- print "$printer\n";
+ foreach my $printer (keys (%::bool)) {
if (int($::bool{$printer})) {
$self->comment_menu($printer, " ");
- print "$printer\n";
$self->add_printer($printer);
}
else {
@@ -169,9 +184,8 @@ sub printer_sharing {
}
sub get_printers {
- my $string;
-
if ($ENV{wiz_do_printer_sharing}) {
+ my $string;
$ENV{wiz_all_printers} and return "all printers";
foreach (keys (%::bool)) {
$string .= "$_, " if int($::bool{$_});
@@ -276,7 +290,7 @@ sub do_it {
$conf->chg_var("global", "server string", $ENV{wiz_banner});
$conf->chg_var("public", "write list", $ENV{wiz_write_list}) if $ENV{wiz_do_file_sharing};
$conf->chg_var("public", "read list", $ENV{wiz_read_list}) if $ENV{wiz_do_file_sharing};
- my $ip = $o->get_from_known_dev("IP");
+ my $ip = $o->itf_get("IPADDR");
if ($ENV{wiz_do_file_sharing}) {
standalone->explanations("Enabling $ENV{wiz_dir} samba file sharing");
$conf->comment_menu("public", " ");
@@ -298,14 +312,14 @@ sub do_it {
standalone->explanations("Samba allow $ENV{wiz_hosts_allow}");
# $conf->chg_var("global", "hosts deny", $ENV{wiz_hosts_deny});
# $conf->chg_var("global", "hosts allow", $ENV{wiz_hosts_allow});
-
+
if ($ENV{wiz_do_printer_sharing}) {
standalone->explanations("Enabling printer sharing");
$conf->printer_sharing();
}
else {
standalone->explanations("Disabling printer sharing");
- foreach $printer (keys (%::bool)) {
+ foreach my $printer (keys (%::bool)) {
if (!int($::bool{$printer})) {
$conf->comment_menu("$printer", ";");
}
diff --git a/time_wizard/scripts/NTPConf.pm b/time_wizard/scripts/NTPConf.pm
index fb37b8a6..77fbe867 100644
--- a/time_wizard/scripts/NTPConf.pm
+++ b/time_wizard/scripts/NTPConf.pm
@@ -20,7 +20,6 @@
package NTPConf;
require "__WIZ_HOME__/common/scripts/Vareqval.pm";
-require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
use MDK::Common;
use strict;
use standalone;
diff --git a/web_wizard/scripts/Webconf.pm b/web_wizard/scripts/Webconf.pm
index fa815aee..4da50a82 100644
--- a/web_wizard/scripts/Webconf.pm
+++ b/web_wizard/scripts/Webconf.pm
@@ -2,12 +2,12 @@
package Webconf;
require "__WIZ_HOME__/common/scripts/Varspaceval.pm";
-require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm";
+require "__WIZ_HOME__/common/scripts/IFCFG.pm";
use MDK::Common;
use strict;
-my $o = DrakconnectConf->new();
+my $o = IFCFG->new();
sub check {
$> and return 1;
@@ -91,7 +91,7 @@ sub do_it {
$that = "all";
}
elsif ($ENV{wiz_web_internal} eq "1") {
- ($that) = $o->get_from_known_dev("IP") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/;
+ ($that) = $o->itf_get("IPADDR") =~ qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.)\d{1,3}$/;
$that .= " 127.0.0.1";
}
cp_af($file, $file.".orig");