summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-01-26 21:47:41 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-01-26 21:47:41 +0000
commit040267fc1f8f13d0fda0f79c0af329cd0df7acf4 (patch)
tree3f86c58dfa0e60f0bb82396b8b0288994e8dac87 /perl-install/network
parent000d45d58f28f8b1f73785f69671d5aa1bddfdbb (diff)
downloaddrakx-040267fc1f8f13d0fda0f79c0af329cd0df7acf4.tar
drakx-040267fc1f8f13d0fda0f79c0af329cd0df7acf4.tar.gz
drakx-040267fc1f8f13d0fda0f79c0af329cd0df7acf4.tar.bz2
drakx-040267fc1f8f13d0fda0f79c0af329cd0df7acf4.tar.xz
drakx-040267fc1f8f13d0fda0f79c0af329cd0df7acf4.zip
(get_eth_cards)
- split it out of conf_network_card_backend() (which still call it for compatibility for now but sincefunctions whose behavior is totally altered by arguments are insane should just be splited, caller will be fixed then this compatibily call removed) - add a third string in returned tuples (physical net device description)
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/ethernet.pm36
1 files changed, 21 insertions, 15 deletions
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm
index 05dbcfc94..b1b768652 100644
--- a/perl-install/network/ethernet.pm
+++ b/perl-install/network/ethernet.pm
@@ -48,6 +48,25 @@ 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() {
+ my @all_cards = detect_devices::getNet();
+
+ my @devs = detect_devices::pcmcia_probe();
+ modules::mergein_conf("$::prefix/etc/modules.conf");
+ my $saved_driver;
+ return map {
+ my $interface = $_;
+ my $a = c::getNetDriver($interface) || modules::get_alias($interface);
+ my $b = find { $_->{device} eq $interface } @devs;
+ $a ||= $b->{driver};
+ $a and $saved_driver = $a; # handle multiple cards managed by the same driver
+ [ $interface, $saved_driver, (mapIntfToDevice($interface))[0]->{description} ]
+ } @all_cards;
+}
+
+
#- conf_network_card_backend : configure the network cards and return the list of them, or configure one specified interface : WARNING, you have to setup the ethernet cards, by calling load_category($in, 'network/main|gigabit|usb', !$::expert, 1) or load_category_backend before calling this function. Basically, you call this function in 2 times.
#- input
#- $prefix
@@ -72,21 +91,8 @@ sub mapIntfToDevice {
sub conf_network_card_backend {
my ($netc, $intf, $o_type, $o_interface, $o_ipadr, $o_netadr) = @_;
#-type =static or dhcp
- if (!$o_interface) {
- my @all_cards = detect_devices::getNet();
-
- my @devs = detect_devices::pcmcia_probe();
- modules::mergein_conf("$::prefix/etc/modules.conf");
- my $saved_driver;
- return map {
- my $interface = $_;
- my $a = c::getNetDriver($interface) || modules::get_alias($interface);
- my $b = find { $_->{device} eq $interface } @devs;
- $a ||= $b->{driver};
- $a and $saved_driver = $a; # handle multiple cards managed by the same driver
- [ $interface, $saved_driver ]
- } @all_cards;
- }
+ return get_eth_cards() if !$o_interface;
+
$o_interface =~ /eth[0-9]+/ or die("the interface is not an ethx");
$netc->{NET_DEVICE} = $o_interface; #- one consider that there is only ONE Internet connection device..