diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-03-09 16:44:43 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-03-09 16:44:43 +0000 |
commit | ce971f65c6ba5901b3ec57da501b45b78fab256d (patch) | |
tree | 1d8d8527283b6017094bbe069822e6b62c5dd54b /perl-install | |
parent | e4b00449f014c0e2000e360114634a24bde6899d (diff) | |
download | drakx-ce971f65c6ba5901b3ec57da501b45b78fab256d.tar drakx-ce971f65c6ba5901b3ec57da501b45b78fab256d.tar.gz drakx-ce971f65c6ba5901b3ec57da501b45b78fab256d.tar.bz2 drakx-ce971f65c6ba5901b3ec57da501b45b78fab256d.tar.xz drakx-ce971f65c6ba5901b3ec57da501b45b78fab256d.zip |
write selected dhcp client in ifcfg files
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/network/ethernet.pm | 14 | ||||
-rw-r--r-- | perl-install/network/netconnect.pm | 6 | ||||
-rw-r--r-- | perl-install/network/network.pm | 4 | ||||
-rwxr-xr-x | perl-install/standalone/drakconnect | 8 |
4 files changed, 21 insertions, 11 deletions
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 3932cb332..d2a32e54e 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -9,7 +9,19 @@ use common; use run_program; use network::tools; -our @dhcp_clients = qw(dhcp-client dhcpcd pump dhcpxd); +our @dhcp_clients = qw(dhclient dhcpcd pump dhcpxd); + +sub install_dhcp_client { + my ($in, $ethntf) = @_; + my %packages = ( + "dhclient" => "dhcp-client", + ); + my $client = $ethntf->{DHCP_CLIENT}; + #- use default dhcp client if none is provided + $client ||= $dhcp_clients[0]; + $client = $packages{$client} if exists $packages{$client}; + $in->do_pkgs->install($client); +} sub write_ether_conf { my ($in, $modules_conf, $netcnx, $netc, $intf) = @_; diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 19ad857bf..2d45e2998 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -1011,8 +1011,7 @@ Do you really want to reconfigure this device?"), delete $ethntf->{NETWORK}; delete $ethntf->{BROADCAST}; delete $ethntf->{TYPE} if $netcnx->{type} ne 'adsl' || !member($adsl_type, qw(manual dhcp)); - $netc->{dhcp_client} ||= (find { -x "$::prefix/sbin/$_" } qw(dhclient dhcpcd pump dhcpxd)) || "dhcp-client"; - $netc->{dhcp_client} = "dhcp-client" if $netc->{dhcp_client} eq "dhclient"; + $ethntf->{DHCP_CLIENT} ||= (find { -x "$::prefix/sbin/$_" } qw(dhclient dhcpcd pump dhcpxd)); }, name => sub { join('', N("Configuring network device %s (driver %s)", $ethntf->{DEVICE}, $module), @@ -1037,7 +1036,7 @@ notation (for example, 1.2.3.4).")), { text => N("Start at boot"), val => \$onboot, type => "bool" }, ), if_($auto_ip, - { label => N("DHCP client"), val => \$netc->{dhcp_client}, + { label => N("DHCP client"), val => \$ethntf->{DHCP_CLIENT}, list => \@network::ethernet::dhcp_clients, advanced => 1 }, { label => N("DHCP timeout (in seconds)"), val => \$ethntf->{DHCP_TIMEOUT}, advanced => 1 }, { text => N("Get DNS servers from DHCP"), val => \$peerdns, type => "bool", advanced => 1 }, @@ -1081,7 +1080,6 @@ notation (for example, 1.2.3.4).")), $ethntf->{HWADDR} = $track_network_id or delete $ethntf->{HWADDR}; $netc->{$_} = $ethntf->{DEVICE} foreach qw(NET_DEVICE NET_INTERFACE); if ($auto_ip) { - $in->do_pkgs->install($netc->{dhcp_client}); #- delete gateway settings if gateway device is invalid or if reconfiguring the gateway interface to dhcp $delete_gateway_settings->($ntf_name); } diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index 1de40d996..4feb2061c 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -164,7 +164,7 @@ sub write_interface_conf { setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR METRIC MII_NOT_SUPPORTED TYPE USERCTL), qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV), - if_($intf->{BOOTPROTO} eq "dhcp", qw(DHCP_HOSTNAME NEEDHOSTNAME PEERDNS PEERYP PEERNTPD DHCP_TIMEOUT)), + if_($intf->{BOOTPROTO} eq "dhcp", qw(DHCP_CLIENT DHCP_HOSTNAME NEEDHOSTNAME PEERDNS PEERYP PEERNTPD DHCP_TIMEOUT)), if_($intf->{DEVICE} =~ /^ippp\d+$/, qw(DIAL_ON_IFUP)) ); substInFile { s/^DEVICE='(`.*`)'/DEVICE=$1/g } $file; #- remove quotes if DEVICE is the result of a command @@ -650,11 +650,11 @@ sub configureNetwork2 { foreach (grep { !/^ppp\d+/ } keys %$intf) { unlink("$etc/sysconfig/network-scripts/$_"); write_interface_conf("$etc/sysconfig/network-scripts/ifcfg-$_", $intf->{$_}, $netc, $::prefix); + $intf->{$_}{BOOTPROTO} eq "dhcp" and network::ethernet::install_dhcp_client($in, $intf->{$_}); } add2hosts("$etc/hosts", $netc->{HOSTNAME}, "127.0.0.1") if $netc->{HOSTNAME}; add2hosts("$etc/hosts", "localhost", "127.0.0.1"); - any { $_->{BOOTPROTO} eq "dhcp" } values %$intf and $in->do_pkgs->install($netc->{dhcp_client} || 'dhcp-client'); if ($netc->{ZEROCONF_HOSTNAME}) { $in->do_pkgs->ensure_binary_is_installed('tmdns', 'tmdns', 'auto') if !$in->do_pkgs->is_installed('bind'); $in->do_pkgs->ensure_binary_is_installed('zcip', 'zcip', 'auto'); diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index 404dcd4c4..15ff08514 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -377,8 +377,8 @@ sub build_notebook { gtkpack__(gtkset_border_width(Gtk2::VBox->new(0,10), 5), gtkpack__(Gtk2::HBox->new, Gtk2::Label->new(N("DHCP client")), - gtksignal_connect($gui->{netc}{dhcp_client} = Gtk2::ComboBox->new_with_strings(\@network::ethernet::dhcp_clients, - $netc->{dhcp_client} || $network::ethernet::dhcp_clients[0]), + gtksignal_connect($gui->{intf}{DHCP_CLIENT} = Gtk2::ComboBox->new_with_strings(\@network::ethernet::dhcp_clients, + $intf->{DHCP_CLIENT} || $network::ethernet::dhcp_clients[0]), changed => $apply)), gtksignal_connect($gui->{intf_bool}{NEEDHOSTNAME} = Gtk2::CheckButton->new(N("Assign host name from DHCP address")), toggled => $apply), gtkpack__(Gtk2::HBox->new, @@ -399,7 +399,7 @@ sub build_notebook { } $gui->{intf}{$_}->set_text($intf->{$_}) foreach qw(DHCP_HOSTNAME DHCP_TIMEOUT); $gui->{intf_bool}{$_}->set_active(text2bool($intf->{$_})) foreach qw(NEEDHOSTNAME PEERDNS PEERYP PEERNTPD); - $gui->{netc}{dhcp_client}->set_text($netc->{dhcp_client}); + $gui->{intf}{DHCP_CLIENT}->set_text($intf->{DHCP_CLIENT}); $gui->{sheet}{DHCP}->set_sensitive($intf->{BOOTPROTO} eq 'dhcp'); } @@ -915,7 +915,7 @@ Configure them first by clicking on 'Configure'"))); [ N("Netmask"), \$mask ], [ N("Boot Protocol"), \$intf->{$interface}{BOOTPROTO}, ["static", "dhcp", "bootp"] ], [ N("Started on boot"), \$intf->{$interface}{ONBOOT} , ["yes", "no"] ], - [ N("DHCP client"), \$netcnx->{dhcp_client} ] + [ N("DHCP client"), \$intf->{$interface}{DHCP_CLIENT} ] ); my $i = 0; my $size_group = Gtk2::SizeGroup->new('horizontal'); |