diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-05-26 11:53:15 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-05-26 11:53:15 +0000 |
commit | c6fbb62abb5a8a9a4aafc5ac343d84b0ea8efcec (patch) | |
tree | 29d67733d139154b7bf65cdc6a7997805bfa5e86 | |
parent | 1bee3e3f34d88e57feba0c3bc6569e89f940659c (diff) | |
download | drakx-c6fbb62abb5a8a9a4aafc5ac343d84b0ea8efcec.tar drakx-c6fbb62abb5a8a9a4aafc5ac343d84b0ea8efcec.tar.gz drakx-c6fbb62abb5a8a9a4aafc5ac343d84b0ea8efcec.tar.bz2 drakx-c6fbb62abb5a8a9a4aafc5ac343d84b0ea8efcec.tar.xz drakx-c6fbb62abb5a8a9a4aafc5ac343d84b0ea8efcec.zip |
create $ask_shorewall_interface_label, shorewall_interface_choices()
and set_net_interface() out of ask_shorewall_interface() to avoid code
duplication
-rw-r--r-- | perl-install/network/shorewall.pm | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/perl-install/network/shorewall.pm b/perl-install/network/shorewall.pm index 5df61ec9b..ab427d2d4 100644 --- a/perl-install/network/shorewall.pm +++ b/perl-install/network/shorewall.pm @@ -54,22 +54,28 @@ sub get_shorewall_interface() { $default_dev; } -sub ask_shorewall_interface { - my ($in, $interface) = @_; +our $ask_shorewall_interface_label = N_("Please enter the name of the interface connected to the internet. + +Examples: + ppp+ for modem or DSL connections, + eth0, or eth1 for cable connection, + ippp+ for a isdn connection. +"); + +sub shorewall_interface_choices { + my ($refval) = @_; my $modules_conf = modules::any_conf->read; my @all_cards = network::ethernet::get_eth_cards($modules_conf); my %net_devices = network::ethernet::get_eth_cards_names(@all_cards); put_in_hash(\%net_devices, { 'ppp+' => 'ppp+', 'ippp+' => 'ippp+' }); - $in->ask_from('', - N("Please enter the name of the interface connected to the internet. + [ { label => N("Net Device"), val => $refval, list => [ sort keys %net_devices ], format => sub { $net_devices{$_[0]} || $_[0] }, not_edit => 0 } ]; +} + +sub ask_shorewall_interface { + my ($in, $interface) = @_; -Examples: - ppp+ for modem or DSL connections, - eth0, or eth1 for cable connection, - ippp+ for a isdn connection. -"), - [ { label => N("Net Device"), val => \$interface, list => [ sort keys %net_devices ], format => sub { $net_devices{$_[0]} || $_[0] }, not_edit => 0 } ]); + $in->ask_from('', translate($ask_shorewall_interface_label), shorewall_interface_choices(\$interface)); $interface; } @@ -77,6 +83,11 @@ sub read_default_interfaces { my ($conf, $o_in) = @_; my $interface = get_shorewall_interface(); $o_in and $interface = ask_shorewall_interface($o_in, $interface); + set_net_interface($conf, $interface); +} + +sub set_net_interface { + my ($conf, $interface) = @_; $conf->{net_interface} = $interface; $conf->{loc_interface} = [ grep { $_ ne $interface } detect_devices::getNet() ]; } |