summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Chaumette <dchaumette@mandriva.com>2003-01-07 14:28:26 +0000
committerDamien Chaumette <dchaumette@mandriva.com>2003-01-07 14:28:26 +0000
commitd16b0d72c9ea1087f7aa0704739a6e45e9e3d52d (patch)
tree0e755cb6afd5b4740d3723281902dd9bacaabb2c
parent7df327c7ea04f08e6378f3f14be6c4dcc2c3e50e (diff)
downloaddrakx-d16b0d72c9ea1087f7aa0704739a6e45e9e3d52d.tar
drakx-d16b0d72c9ea1087f7aa0704739a6e45e9e3d52d.tar.gz
drakx-d16b0d72c9ea1087f7aa0704739a6e45e9e3d52d.tar.bz2
drakx-d16b0d72c9ea1087f7aa0704739a6e45e9e3d52d.tar.xz
drakx-d16b0d72c9ea1087f7aa0704739a6e45e9e3d52d.zip
add network::easy_dhcp function. Quietly setup eth0 in dhcp and restart network.
-rw-r--r--perl-install/network/network.pm28
1 files changed, 27 insertions, 1 deletions
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index bce84c86f..92c11c2b8 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);
+@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);
#-######################################################################################
#- Functions
@@ -415,6 +415,32 @@ sub read_all_conf {
}
}
+sub easy_dhcp {
+ my ($in) = @_;
+ my ($netc, $intf);
+ $netc->{autodetect} = {};
+
+ require network::netconnect;
+ network::netconnect::detect($netc->{autodetect});
+
+ #- 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);
+
+ run_program::rooted('', "/etc/rc.d/init.d/network restart") or return;
+ } else { return 0 }
+ 1;
+}
+
#- configureNetwork2 : configure the network interfaces.
#- input
#- $prefix