summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-03-24 09:59:47 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-03-24 09:59:47 +0000
commitfbbcf8129f8c931cea1279ea5589bd657155be4f (patch)
treeb13208bdc47464e7a05809a6a1d47cbf125a29d5 /perl-install
parent86f242fd200194724a068de6474fb9d97a480355 (diff)
downloaddrakx-fbbcf8129f8c931cea1279ea5589bd657155be4f.tar
drakx-fbbcf8129f8c931cea1279ea5589bd657155be4f.tar.gz
drakx-fbbcf8129f8c931cea1279ea5589bd657155be4f.tar.bz2
drakx-fbbcf8129f8c931cea1279ea5589bd657155be4f.tar.xz
drakx-fbbcf8129f8c931cea1279ea5589bd657155be4f.zip
- network::shorewall::default_interfaces_silent() does not need any parameter
- network::shorewall::read() is simpler with a $o_in - network::drakfirewall::default_from_pkgs() is non interactive, better give it a do_pkgs - cleanup as little as possible
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install_steps_interactive.pm2
-rw-r--r--perl-install/network/drakfirewall.pm15
-rw-r--r--perl-install/network/shorewall.pm18
-rwxr-xr-xperl-install/standalone/drakgw2
-rw-r--r--perl-install/standalone/drakvpn2
5 files changed, 17 insertions, 22 deletions
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index c0b1b2d98..9b5fb997e 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -1096,7 +1096,7 @@ sub summary {
label => N("Firewall"),
val => sub {
require network::shorewall;
- my $shorewall = network::shorewall::read($o, 'silent');
+ my $shorewall = network::shorewall::read();
$shorewall && !$shorewall->{disabled} ? N("activated") : N("disabled");
},
clicked => sub {
diff --git a/perl-install/network/drakfirewall.pm b/perl-install/network/drakfirewall.pm
index b09342752..554f6298f 100644
--- a/perl-install/network/drakfirewall.pm
+++ b/perl-install/network/drakfirewall.pm
@@ -110,8 +110,8 @@ sub from_ports {
}
sub default_from_pkgs {
- my ($in) = @_;
- my @pkgs = $in->do_pkgs->are_installed(map { split ' ', $_->{pkg} } @all_servers);
+ my ($do_pkgs) = @_;
+ my @pkgs = $do_pkgs->are_installed(map { split ' ', $_->{pkg} } @all_servers);
[ grep {
my $s = $_;
exists $s->{force_default_selection} ?
@@ -120,15 +120,14 @@ sub default_from_pkgs {
} @all_servers ];
}
-sub get_ports {
- my ($in, $_ports) = @_;
- my $shorewall = network::shorewall::read($in, 'silent') or return;
+sub get_ports() {
+ my $shorewall = network::shorewall::read() or return;
\$shorewall->{ports};
}
sub set_ports {
my ($in, $disabled, $ports) = @_;
- my $shorewall = network::shorewall::read($in, 'not_silent') || network::shorewall::default_interfaces($in) or die N("No network card");
+ my $shorewall = network::shorewall::read($in) || network::shorewall::default_interfaces($in) or die N("No network card");
if (!$disabled || -x "$::prefix/sbin/shorewall") {
$in->do_pkgs->ensure_binary_is_installed('shorewall', 'shorewall', $::isInstall) or return;
@@ -141,12 +140,12 @@ sub set_ports {
sub get_conf {
my ($in, $disabled, $o_ports) = @_;
- my $possible_servers = default_from_pkgs($in);
+ my $possible_servers = default_from_pkgs($in->do_pkgs);
$_->{hide} = 0 foreach @$possible_servers;
if ($o_ports) {
$disabled, from_ports($o_ports);
- } elsif (my $shorewall = network::shorewall::read($in, 'silent')) {
+ } elsif (my $shorewall = network::shorewall::read()) {
$shorewall->{disabled}, from_ports(\$shorewall->{ports});
} else {
$in->ask_okcancel('', N("drakfirewall configurator
diff --git a/perl-install/network/shorewall.pm b/perl-install/network/shorewall.pm
index 563914578..eb3a4e045 100644
--- a/perl-install/network/shorewall.pm
+++ b/perl-install/network/shorewall.pm
@@ -61,11 +61,10 @@ sub get_net_device() {
$default_dev;
}
-sub default_interfaces_silent {
- my ($_in) = @_;
- my %conf;
- my @l = detect_devices::getNet() or return;
- if (@l == 1) {
+sub default_interfaces_silent() {
+ my %conf;
+ my @l = detect_devices::getNet() or return;
+ if (@l == 1) {
$conf{net_interface} = $l[0];
} else {
$conf{net_interface} = get_net_device() || $l[0];
@@ -103,7 +102,7 @@ Examples:
}
sub read {
- my ($in, $mode) = @_;
+ my ($o_in) = @_;
my %conf = (disabled => !glob_("$::prefix/etc/rc3.d/S*shorewall"),
ports => join(' ', map {
my $e = $_;
@@ -114,11 +113,8 @@ sub read {
if (my ($e) = get_config_file('masq')) {
$conf{masquerade}{subnet} = $e->[1] if $e->[1];
}
- if ($mode eq 'silent') {
- put_in_hash(\%conf, default_interfaces_silent($in));
- } else {
- put_in_hash(\%conf, default_interfaces($in));
- }
+ put_in_hash(\%conf, $o_in ? default_interfaces($o_in) : default_interfaces_silent());
+
$conf{net_interface} && \%conf;
}
diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw
index 11c982fd5..7f23e964c 100755
--- a/perl-install/standalone/drakgw
+++ b/perl-install/standalone/drakgw
@@ -53,7 +53,7 @@ my $squid_port = network::network::read_squid_conf()->{http_port}[0] ||= "3128";
my $cups_conf = "/etc/cups/cupsd.conf";
my $in = 'interactive'->vnew('su');
-my $shorewall = network::shorewall::read($in, 'silent');
+my $shorewall = network::shorewall::read();
$::Wizard_title = N("Internet Connection Sharing");
diff --git a/perl-install/standalone/drakvpn b/perl-install/standalone/drakvpn
index 7ad344465..a43411055 100644
--- a/perl-install/standalone/drakvpn
+++ b/perl-install/standalone/drakvpn
@@ -57,7 +57,7 @@ my $proc_version = "";
my $ipsec_package = "";
my $in = interactive->vnew('su');
-my $shorewall = network::shorewall::read($in, 'silent');
+my $shorewall = network::shorewall::read();
my @section_names;
if ($kernel_version > 2.5) {