summaryrefslogtreecommitdiffstats
path: root/perl-install/network/ethernet.pm
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2001-07-04 22:14:46 +0000
committerdamien <damien@mandriva.com>2001-07-04 22:14:46 +0000
commit4eff584aa8d9fbe794e2d334824a052d4f69ccf4 (patch)
tree29aa16458a2ce06f0f0d9d2dc7f7d3ebcbf5ac04 /perl-install/network/ethernet.pm
parent1d2aa43fb74f274d43d1c10bf61476d0231d7c3d (diff)
downloaddrakx-4eff584aa8d9fbe794e2d334824a052d4f69ccf4.tar
drakx-4eff584aa8d9fbe794e2d334824a052d4f69ccf4.tar.gz
drakx-4eff584aa8d9fbe794e2d334824a052d4f69ccf4.tar.bz2
drakx-4eff584aa8d9fbe794e2d334824a052d4f69ccf4.tar.xz
drakx-4eff584aa8d9fbe794e2d334824a052d4f69ccf4.zip
modularization continuated
Diffstat (limited to 'perl-install/network/ethernet.pm')
-rw-r--r--perl-install/network/ethernet.pm63
1 files changed, 55 insertions, 8 deletions
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm
index e3dc4bf9f..52b4afd70 100644
--- a/perl-install/network/ethernet.pm
+++ b/perl-install/network/ethernet.pm
@@ -1,10 +1,11 @@
package network::ethernet;
-use network;
+use network::network;
use modules;
use any;
use detect_devices;
-use common qw(:file);
+use common qw(:file :common);
+use run_program;
use vars qw(@ISA @EXPORT);
use globals "network", qw($in $prefix $install);
@@ -49,11 +50,9 @@ Default is dhcpcd"),
sub configure_lan {
my ($netcnx, $netc, $intf, $first_time) = @_;
$::isInstall and $in->set_help('configureNetworkIP');
- print "plop2 ------------ $in ----------- \n";
require Data::Dumper;
- print "plop :" . Data::Dumper->Dump([\$in], ['$in']) . "\n";
- network::configureNetwork($prefix, $netc, $in, $intf, $first_time) or return;
- network::configureNetwork2($in, $prefix, $netc, $intf, $install);
+ configureNetwork($netc, $intf, $first_time) or return;
+ configureNetwork2($in, $prefix, $netc, $intf, $install);
if ($::isStandalone and $in->ask_yesorno(_("Network configuration"),
_("Do you want to restart the network"), 1)) {
run_program::rooted($prefix, "/etc/rc.d/init.d/network stop");
@@ -105,7 +104,7 @@ I cannot set up this connection type.")) and return;
my $device=conf_network_card_backend($prefix, $netc, $intf, $type, $interface, $ipadr, $netadr, $interface);
if ( $::isStandalone and !($type eq "dhcp")) {
$in->ask_yesorno(_("Network interface"),
- _("I'm about to restart the network device:\n") . $device . _("\nDo you agree?"), 1) and network::configureNetwork2($in, $prefix, $netc, $intf) and system("$prefix/sbin/ifdown $device;$prefix/sbin/ifup $device");
+ _("I'm about to restart the network device:\n") . $device . _("\nDo you agree?"), 1) and configureNetwork2($in, $prefix, $netc, $intf) and system("$prefix/sbin/ifdown $device;$prefix/sbin/ifup $device");
}
1;
}
@@ -168,7 +167,7 @@ sub go_ethernet {
my ($netc, $intf, $type, $ipadr, $netadr, $first_time) = @_;
conf_network_card($netc, $intf, $type, $ipadr, $netadr) or return;
$netc->{NET_INTERFACE}=$netc->{NET_DEVICE};
- network::configureNetwork($prefix, $netc, $in, $intf, $first_time) or return;
+ configureNetwork($netc, $intf, $first_time) or return;
output "$prefix$connect_file",
qq(
#!/bin/bash
@@ -188,4 +187,52 @@ ifdown $netc->{NET_DEVICE}
1;
}
+sub configureNetwork {
+ my ($netc, $intf, $first_time) = @_;
+ print "plop3 -- $prefix \n";
+ local $_;
+ any::setup_thiskind($in, 'net', !$::expert, 1);
+ my @l = detect_devices::getNet() or die _("no network card found");
+ my @all_cards = network::ethernet::conf_network_card_backend ($prefix, $netc, $intf, undef, undef, undef, undef);
+
+ configureNetwork_step_1:
+ my $n_card=0;
+ $netc ||= {};
+ my $last; foreach (@l) {
+ my $intf2 = findIntf($intf ||= {}, $_);
+ add2hash($intf2, $last);
+ add2hash($intf2, { NETMASK => '255.255.255.0' });
+ configureNetworkIntf($netc, $in, $intf2, $netc->{NET_DEVICE}, 0, $all_cards[$n_card]->[1]) or return;
+
+ $last = $intf2;
+ $n_card++;
+ }
+ #- {
+ #- my $wait = $o->wait_message(_("Hostname"), _("Determining host name and domain..."));
+ #- network::guessHostname($o->{prefix}, $o->{netc}, $o->{intf});
+ #- }
+ $last or return;
+ if ($last->{BOOTPROTO} =~ /^(dhcp|bootp)$/) {
+ $netc->{minus_one} = 1;
+ my $dhcp_hostname = $netc->{HOSTNAME};
+ $::isInstall and $in->set_help('configureNetworkHostDHCP');
+ $in->ask_from_entries_refH(_("Configuring network"),
+_("Please enter your host name if you know it.
+Some DHCP servers require the hostname to work.
+Your host name should be a fully-qualified host name,
+such as ``mybox.mylab.myco.com''."),
+ [ { label => _("Host name"), val => \$netc->{HOSTNAME} }]) or goto configureNetwork_step_1;
+ $netc->{HOSTNAME} ne $dhcp_hostname and $netc->{DHCP_HOSTNAME} = $netc->{HOSTNAME};
+ } else {
+ configureNetworkNet($in, $netc, $last ||= {}, @l) or goto configureNetwork_step_1;
+ if ( $netc->{GATEWAY} ) {
+ unlink "$prefix/etc/sysconfig/network-scripts/net_cnx_up";
+ unlink "$prefix/etc/sysconfig/network-scripts/net_cnx_down";
+ undef $netc->{NET_DEVICE};
+ }
+ }
+ miscellaneousNetwork($in);
+ 1;
+}
+
1;