From bb7cb2a72ab19d9c2eeb7cad5b2831e6ad4aa378 Mon Sep 17 00:00:00 2001 From: Damien Chaumette Date: Mon, 20 Jan 2003 18:24:01 +0000 Subject: - zero conf is avaible in drakconnect, with/without dhcp - install tmdns and zcip packages when needed --- perl-install/network/ethernet.pm | 20 +++++--------------- perl-install/network/network.pm | 30 +++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 24 deletions(-) (limited to 'perl-install') diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index b3e4eb1ee..22bb7b9ec 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -17,13 +17,7 @@ sub configure_cable { my ($netcnx, $netc, $intf, $first_time) = @_; $::isInstall and $in->set_help('configureNetworkCable'); $netcnx->{type} = 'cable'; - # $netcnx->{cable}={}; - # $in->ask_from_entries_ref(N("Cable connection"), - # N("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''."), - # [N("Host name:")], [ \$netcnx->{cable}{hostname} ]); + if ($::expert) { my @m = ( { description => "dhcp-client", @@ -62,7 +56,7 @@ sub configure_lan { configureNetwork($netc, $intf, $first_time) or return; configureNetwork2($in, $prefix, $netc, $intf); $netc->{NETWORKING} = "yes"; - if ($netc->{GATEWAY} || any { $_->{BOOTPROTO} eq 'dhcp' } values %$intf) { + if ($netc->{GATEWAY} || any { $_->{BOOTPROTO} =~ /dhcp/ } values %$intf) { $netcnx->{type} = 'lan'; $netcnx->{NET_DEVICE} = $netc->{NET_DEVICE} = ''; $netcnx->{NET_INTERFACE} = 'lan'; #$netc->{NET_INTERFACE}; @@ -150,8 +144,7 @@ sub conf_network_card_backend { my ($device) = $interface =~ /(ADIModem|eth[0-9]+)/ or die("the interface is not an ethx or other (like ADIModem)"); $netc->{NET_DEVICE} = $device; #- one consider that there is only ONE Internet connection device.. - @{$intf->{$device}}{qw(DEVICE BOOTPROTO NETMASK NETWORK ONBOOT)} = - ($device, $type, '255.255.255.0', $netadr, 'yes'); + @{$intf->{$device}}{qw(DEVICE BOOTPROTO NETMASK NETWORK ONBOOT)} = ($device, $type, '255.255.255.0', $netadr, 'yes'); $intf->{$device}{IPADDR} = $ipadr if $ipadr; $device; @@ -188,12 +181,9 @@ sub configureNetwork { $last = $intf2; $n_card++; } - #- { - #- my $wait = $o->wait_message(N("Hostname"), N("Determining host name and domain...")); - #- network::guessHostname($o->{prefix}, $o->{netc}, $o->{intf}); - #- } $last or return; - if ($last->{BOOTPROTO} =~ /^(dhcp|bootp)$/) { + + if ($last->{BOOTPROTO} =~ /dhcp|bootp|zeroconf/) { $netc->{minus_one} = 1; $netc->{DHCP} = 1; my $dhcp_hostname = $netc->{HOSTNAME}; diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index d2db378dd..067db1802 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -144,6 +144,8 @@ sub write_interface_conf { ONBOOT => bool2yesno(!member($intf->{DEVICE}, map { $_->{device} } detect_devices::probeall())), }); + $intf->{BOOTPROTO} =~ s/dhcp.*/dhcp/; #- TODO: avoid obfuscating BOOTPROTO, waiting for zeroconf conf details + setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR), if_($intf->{wireless_eth}, 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_($dhcp_hostname, DHCP_HOSTNAME), if_(!$dhcp_hostname, NEEDHOSTNAME)); } @@ -295,10 +297,10 @@ Modifying the fields below will override this configuration."); Each item should be entered as an IP address in dotted-decimal notation (for example, 1.2.3.4)."); } - my $pump = $intf->{BOOTPROTO} =~ /^(dhcp|bootp)$/; + my $pump = $intf->{BOOTPROTO} =~ /dhcp|bootp|zeroconf/; + my ($dhcp, $zeroconf, $onboot) = (1, 1, 1); delete $intf->{NETWORK}; delete $intf->{BROADCAST}; - my $onboot = 1; my @fields = qw(IPADDR NETMASK); $::isStandalone or $in->set_help('configureNetworkIP'); $in->ask_from(N("Configuring network device %s", $intf->{DEVICE}), @@ -306,8 +308,11 @@ notation (for example, 1.2.3.4)."); $text, [ { label => N("IP address"), val => \$intf->{IPADDR}, disabled => sub { $pump } }, { label => N("Netmask"), val => \$intf->{NETMASK}, disabled => sub { $pump } }, - { label => N("Automatic IP"), val => \$pump, type => "bool", text => N("(bootp/dhcp)") }, - if_($::expert, { label => N("Start at boot"), val => \$onboot, type => "bool" }), + if_(!$::expert, { label => N("Automatic IP"), val => \$pump, type => "bool", text => N("(bootp/dhcp/zeroconf)") }), + if_($::expert, { label => N("Automatic IP"), val => \$pump, type => "bool" }, + { label => N(""), val => \$dhcp, type => "bool", text => N("bootp/dhcp"), disabled => sub { !$pump } }, + { label => N(""), val => \$zeroconf, type => "bool", text => N("zeroconf"), disabled => sub { !$pump } }, + { label => N("Start at boot"), val => \$onboot, type => "bool" }), if_($intf->{wireless_eth}, { label => "WIRELESS_MODE", val => \$intf->{WIRELESS_MODE}, list => [ "Ad-hoc", "Managed", "Master", "Repeater", "Secondary", "Auto" ] }, { label => "WIRELESS_ESSID", val => \$intf->{WIRELESS_ESSID} }, @@ -324,8 +329,12 @@ notation (for example, 1.2.3.4)."); ), ], complete => sub { - $intf->{BOOTPROTO} = $pump ? "dhcp" : "static"; - return 0 if $pump; + $intf->{BOOTPROTO} = $pump ? if_($dhcp, "dhcp") . if_($zeroconf, "zeroconf") : "static"; + if ($pump and !$dhcp and !$zeroconf ) { + $in->ask_warn('', N("For an Automatic IP you have to select at least one protocol : dhcp or zeroconf")); + return (1,$i); + } + return 0 if $pump; for (my $i = 0; $i < @fields; $i++) { unless (is_ip($intf->{$fields[$i]})) { $in->ask_warn('', N("IP address should be in format 1.2.3.4")); @@ -476,17 +485,20 @@ sub easy_dhcp { sub configureNetwork2 { my ($in, $prefix, $netc, $intf) = @_; my $etc = "$prefix/etc"; - + $netc->{wireless_eth} and $in->do_pkgs->install(qw(wireless-tools)); write_conf("$etc/sysconfig/network", $netc); write_resolv_conf("$etc/resolv.conf", $netc); write_interface_conf("$etc/sysconfig/network-scripts/ifcfg-$_->{DEVICE}", $_, $intf->{DHCP_HOSTNAME}, $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) { + + 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'); } -- cgit v1.2.1