diff options
author | Damien Chaumette <dchaumette@mandriva.com> | 2003-02-03 01:13:17 +0000 |
---|---|---|
committer | Damien Chaumette <dchaumette@mandriva.com> | 2003-02-03 01:13:17 +0000 |
commit | e734893910ec95175fba3ae10cf8a1671d6345d3 (patch) | |
tree | 249888f95c42ef6b83310eeb373f0f2905ff41fd | |
parent | 7f75ad9564adab60db74a28c27bdc3b934828cf0 (diff) | |
download | drakx-backup-do-not-use-e734893910ec95175fba3ae10cf8a1671d6345d3.tar drakx-backup-do-not-use-e734893910ec95175fba3ae10cf8a1671d6345d3.tar.gz drakx-backup-do-not-use-e734893910ec95175fba3ae10cf8a1671d6345d3.tar.bz2 drakx-backup-do-not-use-e734893910ec95175fba3ae10cf8a1671d6345d3.tar.xz drakx-backup-do-not-use-e734893910ec95175fba3ae10cf8a1671d6345d3.zip |
- fix zeroconf support
- cleanups
-rw-r--r-- | perl-install/network/ethernet.pm | 11 | ||||
-rw-r--r-- | perl-install/network/network.pm | 40 |
2 files changed, 16 insertions, 35 deletions
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 6df6bc30e..febfc0b46 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -1,6 +1,6 @@ package network::ethernet; -use strict; + use network::network; use modules; use modules::interactive; @@ -8,7 +8,7 @@ use detect_devices; use common; use run_program; use network::tools; -use vars qw(@ISA @EXPORT); + use MDK::Common::Globals "network", qw($in $prefix); @ISA = qw(Exporter); @@ -156,10 +156,6 @@ sub go_ethernet { conf_network_card($netc, $intf, $type, $ipadr, $netadr) or return; $netc->{NET_INTERFACE} = $netc->{NET_DEVICE}; configureNetwork($netc, $intf, $first_time) or return; -# if ( $::isStandalone and $netc->{NET_DEVICE}) { -# $in->ask_yesorno(N("Network interface"), -# N("I'm about to restart the network device %s. Do you agree?", $netc->{NET_DEVICE}), 1) and system("$prefix/sbin/ifdown $netc->{NET_DEVICE}; $prefix/sbin/ifup $netc->{NET_DEVICE}"); -# } 1; } @@ -186,7 +182,6 @@ sub configureNetwork { if ($last->{BOOTPROTO} !~ /static/) { $netc->{minus_one} = 1; - $netc->{DHCP} = 1; $::isInstall and $in->set_help('configureNetworkHostDHCP'); $in->ask_from(N("Configuring network"), N("Please enter your host name if you know it. @@ -194,7 +189,7 @@ 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 => N("Host name"), val => \$netc->{HOSTNAME} }, - { label => N("Zeroconf Host name"), val => \$netc->{ZEROCONF_HOSTNAME} }, + if_($netc->{ZEROCONF}, { label => N("Zeroconf Host name"), val => \$netc->{ZEROCONF_HOSTNAME} }), ]) or goto configureNetwork_step_1; } else { configureNetworkNet($in, $netc, $last ||= {}, @l) or goto configureNetwork_step_1; diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index ad2a78be0..ae341e926 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -3,14 +3,14 @@ package network::network; # $Id$wir #-###################################################################################### #- misc imports #-###################################################################################### -use strict; + use Socket; use common; use detect_devices; use run_program; use any; 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); @@ -75,9 +75,9 @@ sub write_conf { sub write_zeroconf { my ($file, $netc); - my %zeroconf_file = getVarsFromSh($file) or die "cannot open file $file: $!"; + my %zeroconf_file = getVarsFromSh($file) or die "$file isn't installed"; $zeroconf_file{hostname} = $netc->{ZEROCONF_HOSTNAME}; - setVarsInSh($file, %zeroconf_file); + setVarsInSh($file, \%zeroconf_file); } sub write_resolv_conf { @@ -301,7 +301,7 @@ Each item should be entered as an IP address in dotted-decimal notation (for example, 1.2.3.4)."); } my $auto_ip = $intf->{BOOTPROTO} !~ /static/; - my ($dhcp, $zeroconf, $onboot) = (1, 1, 1); + my ($zeroconf, $onboot) = (1, 1); delete $intf->{NETWORK}; delete $intf->{BROADCAST}; my @fields = qw(IPADDR NETMASK); @@ -312,8 +312,7 @@ notation (for example, 1.2.3.4)."); [ { label => N("IP address"), val => \$intf->{IPADDR}, disabled => sub { $auto_ip } }, { label => N("Netmask"), val => \$intf->{NETMASK}, disabled => sub { $auto_ip } }, if_(!$::expert, { label => N("Automatic IP"), val => \$auto_ip, type => "bool", text => N("(bootp/dhcp/zeroconf)") }), - if_($::expert, { label => N("Automatic IP"), val => \$auto_ip, type => "bool" }, - { val => \$dhcp, type => "bool", text => N("bootp/dhcp"), disabled => sub { !$auto_ip } }, + if_($::expert, { label => N("Automatic IP"), val => \$auto_ip, type => "bool", text => N("(bootp/dhcp)") }, { val => \$zeroconf, type => "bool", text => N("zeroconf"), disabled => sub { !$auto_ip } }, { label => N("Start at boot"), val => \$onboot, type => "bool" }), if_($intf->{wireless_eth}, @@ -333,13 +332,9 @@ notation (for example, 1.2.3.4)."); ], complete => sub { - $intf->{BOOTPROTO} = $auto_ip ? join('', if_($dhcp, "dhcp") , if_($zeroconf, "zeroconf")) : "static"; - - if ($auto_ip && !$dhcp && !$zeroconf) { - $in->ask_warn('', N("For an Automatic IP you have to select at least one protocol : dhcp or zeroconf")); - return 1; - } - return 0 if $auto_ip; + $intf->{BOOTPROTO} = $auto_ip ? join('', if_($auto_ip, "dhcp") , if_($zeroconf, "zeroconf")) : "static"; + $netc->{DHCP} = $auto_ip; + $netc->{ZEROCONF} = $zeroconf if $auto_ip; if (my @bad = map_index { if_(!is_ip($intf->{$_}), $::i) } @fields) { $in->ask_warn('', N("IP address should be in format 1.2.3.4")); @@ -497,20 +492,11 @@ sub configureNetwork2 { write_interface_conf("$etc/sysconfig/network-scripts/ifcfg-$_->{DEVICE}", $_, $netc, $prefix) foreach grep { $_->{DEVICE} } values %$intf; add2hosts("$etc/hosts", "localhost", "127.0.0.1"); add2hosts("$etc/hosts", $netc->{HOSTNAME}, map { $_->{IPADDR} } values %$intf); - - if (any { $_->{BOOTPROTO} =~ /dhcp/ } values %$intf) { - $in->do_pkgs->install($netc->{dhcp_client} || 'dhcp-client'); - } - if (any { $_->{BOOTPROTO} =~ /zeroconf/ } values %$intf) { - $in->do_pkgs->install(qw(tmdns zcip)); - } - if (any { $_->{BOOTPROTO} =~ /^(pump|bootp)$/ } values %$intf) { - $in->do_pkgs->install('pump'); - } - #-res_init(); #- reinit the resolver so DNS changes take affect - - write_zeroconf('/etc/tmdns.conf', $netc) if $netc->{ZEROCONF_HOSTNAME}; + $netc->{DHCP} && $in->do_pkgs->install($netc->{dhcp_client} || 'dhcp-client'); + $netc->{ZEROCONF} && $in->do_pkgs->install(qw(tmdns zcip)) and write_zeroconf('/etc/tmdns.conf', $netc); + any { $_->{BOOTPROTO} =~ /^(pump|bootp)$/ } values %$intf and $in->do_pkgs->install('pump'); + proxy_configure($::o->{miscellaneous}); } |