summaryrefslogtreecommitdiffstats
path: root/perl-install/network/ethernet.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-07-21 00:16:04 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-07-21 00:16:04 +0000
commit7e8fa9773839843c9d8def81ec2ef1315115825a (patch)
treeb20f63ae9f67b2d9c7e8aa6a2b86d56e0d953743 /perl-install/network/ethernet.pm
parent54b71cdf438434e4693aa6064596f4fdb4aac59e (diff)
downloaddrakx-7e8fa9773839843c9d8def81ec2ef1315115825a.tar
drakx-7e8fa9773839843c9d8def81ec2ef1315115825a.tar.gz
drakx-7e8fa9773839843c9d8def81ec2ef1315115825a.tar.bz2
drakx-7e8fa9773839843c9d8def81ec2ef1315115825a.tar.xz
drakx-7e8fa9773839843c9d8def81ec2ef1315115825a.zip
- %modules::conf is no more a global, so many functions need passing $modules_conf
- $modules_conf is a class choosing modules.conf or modprobe.conf (esp. useful after install) (but not working yet!) - modules::load() doesn't use $modules_conf, use modules::load_and_configure() - modules::load() doesn't allow options, use either modules::load_raw() or modules::load_and_configure() - some functions used to want an array ref for modules options and some a string, now every functions use a string - many functions (like modules::get_alias()) are now methods on $modules_conf - some functions in mouse.pm needed a $in where a $do_pkgs is enough - some perl_checker compliance - small fixes
Diffstat (limited to 'perl-install/network/ethernet.pm')
-rw-r--r--perl-install/network/ethernet.pm27
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);
}
}