diff options
Diffstat (limited to 'perl-install/network/ethernet.pm')
-rw-r--r-- | perl-install/network/ethernet.pm | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 6f9cc8c85..a93d66c77 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -14,7 +14,7 @@ use vars qw(@ISA @EXPORT); @EXPORT = qw(conf_network_card_backend); sub write_ether_conf { - my ($in, $netcnx, $netc, $intf) = @_; + my ($in, $modules_conf, $netcnx, $netc, $intf) = @_; configureNetwork2($in, $::prefix, $netc, $intf); $netc->{NETWORKING} = "yes"; if ($netc->{GATEWAY} || any { $_->{BOOTPROTO} =~ /dhcp/ } values %$intf) { @@ -30,7 +30,7 @@ qq( /sbin/ifup lo ), $netcnx->{type}); } - $::isStandalone and modules::write_conf(); + $::isStandalone and $modules_conf->write; 1; } @@ -46,16 +46,16 @@ sub mapIntfToDevice { # return list of [ intf_name, module, device_description ] tuples such as: # [ "eth0", "3c59x", "3Com Corporation|3c905C-TX [Fast Etherlink]" ] -sub get_eth_cards() { +sub get_eth_cards { + my ($modules_conf) = @_; my @all_cards = detect_devices::getNet(); my @devs = detect_devices::pcmcia_probe(); - modules::mergein_conf(); my $saved_driver; return map { my $interface = $_; my $description; - my $a = c::getNetDriver($interface) || modules::get_alias($interface); + my $a = c::getNetDriver($interface) || $modules_conf->get_alias($interface); if (my $b = find { $_->{device} eq $interface } @devs) { # PCMCIA case $a = $b->{driver}; $description = $b->{description}; @@ -64,18 +64,18 @@ sub get_eth_cards() { } if (!$description) { my $drv = readlink("/sys/class/net/$interface/driver"); - if ($drv and $drv =~ s!.*/!!) { + if ($drv && $drv =~ s!.*/!!) { $a = $drv; my %l; my %sysfs_fields = (id => "device", subid => "subsystem_device", vendor => "vendor", subvendor => "subsystem_vendor"); $l{$_} = hex(chomp_(cat_("/sys/class/net/$interface/device/" . $sysfs_fields{$_}))) foreach keys %sysfs_fields; my @cards = grep { my $dev = $_; every { $dev->{$_} eq $l{$_} } keys %l } detect_devices::probeall(); - $description = $cards[0]{description} if $#cards == 0; + $description = $cards[0]{description} if @cards == 1; } } if (!$description) { my @cards = grep { $_->{driver} eq ($a || $saved_driver) } detect_devices::probeall(); - $description = $cards[0]->{description} if $#cards == 0; + $description = $cards[0]{description} if @cards == 1; } $a and $saved_driver = $a; # handle multiple cards managed by the same driver [ $interface, $saved_driver, if_($description, $description) ] @@ -83,11 +83,11 @@ sub get_eth_cards() { } sub get_eth_cards_names { - my (@all_cards) = @_; + my ($modules_conf, @all_cards) = @_; foreach my $card (@all_cards) { - modules::remove_alias($card->[1]); - modules::set_alias($card->[0], $card->[1]); + $modules_conf->remove_alias($card->[1]); + $modules_conf->set_alias($card->[0], $card->[1]); } { map { $_->[0] => join(': ', $_->[0], $_->[2]) } @all_cards }; @@ -131,10 +131,11 @@ sub conf_network_card_backend { } # automatic net aliases configuration -sub configure_eth_aliases() { +sub configure_eth_aliases { + my ($modules_conf) = @_; foreach (detect_devices::getNet()) { my $driver = c::getNetDriver($_) or next; - modules::set_alias($_, $driver); + $modules_conf->set_alias($_, $driver); } } |