summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/network.pm38
1 files changed, 19 insertions, 19 deletions
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 92c11c2b8..2339c270f 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -13,7 +13,7 @@ use log;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
-@EXPORT = qw(resolv configureNetworkIntf netmask dns is_ip masked_ip findIntf addDefaultRoute read_all_conf dnsServers guessHostname configureNetworkNet read_resolv_conf read_interface_conf add2hosts gateway configureNetwork2 write_conf sethostname down_it read_conf write_resolv_conf up_it, easy_dhcp);
+@EXPORT = qw(resolv configureNetworkIntf netmask dns is_ip masked_ip findIntf addDefaultRoute read_all_conf dnsServers guessHostname configureNetworkNet read_resolv_conf read_interface_conf add2hosts gateway configureNetwork2 write_conf sethostname down_it read_conf write_resolv_conf up_it);
#-######################################################################################
#- Functions
@@ -416,28 +416,28 @@ sub read_all_conf {
}
sub easy_dhcp {
- my ($in) = @_;
- my ($netc, $intf);
- $netc->{autodetect} = {};
+ my ($in, $netc, $intf) = @_;
- require network::netconnect;
- network::netconnect::detect($netc->{autodetect});
+ return if text2bool($netc->{NETWORKING});
+
+ require modules;
+ require network::ethernet;
+ modules::load_category('network/main|usb');
+ my @all_cards = network::ethernet::conf_network_card_backend();
#- only for a single network card
- if ($netc->{autodetect}{lan}{eth0} && !$netc->{autodetect}{lan}{eth1}) {
- $netc->{NETWORKING} = "yes";
- $netc->{FORWARD_IPV4} = "false";
- $netc->{HOSTNAME} = "localhost.localdomain";
- $netc->{DOMAINNAME} = "localdomain";
- $intf->{eth0}{DEVICE} = "eth0";
- $intf->{eth0}{BOOTPROTO} = "dhcp";
- $intf->{eth0}{ONBOOT} = "yes";
- $intf->{eth0}{NETMASK} = "255.255.255.0";
-
- configureNetwork2($in, '', $netc, $intf);
+ any { $_ eq 'eth0' } @all_cards && every { $_ ne 'eth1' } @all_cards or return;
+
+ network::ethernet::conf_network_card_backend($netc, $intf, 'dhcp', 'eth0');
+
+ put_in_hash($netc, {
+ NETWORKING => "yes",
+ FORWARD_IPV4 => "false",
+ HOSTNAME => "localhost.localdomain",
+ DOMAINNAME => "localdomain",
+ });
- run_program::rooted('', "/etc/rc.d/init.d/network restart") or return;
- } else { return 0 }
+ configureNetwork2($in, '', $netc, $intf);
1;
}