From 455a9ed27c9ffdfd2e93df58e97eec12a502a12a Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 29 Dec 2003 18:46:45 +0000 Subject: (wip but requested for string freeze) - do not silently discard errors by ignoring exceptions - use new wizard layer - begin to renew wizard steps (mdk10.0 specs) --- perl-install/network/tools.pm | 91 +++---------------------------------------- 1 file changed, 6 insertions(+), 85 deletions(-) (limited to 'perl-install/network/tools.pm') diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 05ef51c94..9735aef4b 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -9,7 +9,7 @@ use MDK::Common::Globals "network", qw($in $prefix $disconnect_file $connect_pro use MDK::Common::System qw(getVarsFromSh); @ISA = qw(Exporter); -@EXPORT = qw(ask_connect_now ask_info2 connect_backend connected connected_bg disconnect_backend is_dynamic_ip is_wireless_intf passwd_by_login read_providers_backend read_secret_backend test_connected write_cnx_script write_initscript write_secret_backend); +@EXPORT = qw(ask_info2 connect_backend connected connected_bg disconnect_backend is_dynamic_ip is_wireless_intf passwd_by_login read_providers_backend read_secret_backend test_connected write_cnx_script write_initscript write_secret_backend); @EXPORT_OK = qw($in); sub write_cnx_script { @@ -69,96 +69,12 @@ sub passwd_by_login { } } -sub ask_connect_now { - my ($type) = @_; - $::Wizard_no_previous = 1; - my $up = 1; - #- FIXME : code the exception to be generated by ask_yesorno, to be able to remove the $::Wizard_no_previous=1; - if ($in->ask_yesorno(N("Internet configuration"), - N("Do you want to try to connect to the Internet now?") - )) { - { - my $_w = $in->wait_message('', N("Testing your connection..."), 1); - connect_backend(); - my $s = 30; - $type =~ /modem/ and $s = 50; - $type =~ /adsl/ and $s = 35; - $type =~ /isdn/ and $s = 20; - sleep $s; - $up = connected(); - } - my $m = $up ? N("The system is now connected to the Internet.") . - if_($::isInstall, N("For security reasons, it will be disconnected now.")) : - N("The system doesn't seem to be connected to the Internet. -Try to reconfigure your connection."); - $::Wizard_no_previous = 1; - $::Wizard_finished = 1; - $in->ask_okcancel(N("Network Configuration"), $m, 1); - undef $::Wizard_no_previous; - undef $::Wizard_finished; - $::isInstall and disconnect_backend(); - } - undef $::Wizard_no_previous; - $up; -} - sub connect_backend() { run_program::rooted($prefix, "$connect_file &") } sub disconnect_backend() { run_program::rooted($prefix, "$disconnect_file &") } sub read_providers_backend { my ($file) = @_; map { /(.*?)=>/ } catMaybeCompressed($file) } -sub ask_info2 { - my ($cnx, $netc) = @_; - - $in->ask_from(N("Connection Configuration"), - N("Please fill or check the field below"), - [ - if__($cnx->{irq}, { label => N("Card IRQ"), val => \$cnx->{irq} }), - if__($cnx->{mem}, { label => N("Card mem (DMA)"), val => \$cnx->{mem} }), - if__($cnx->{io}, { label => N("Card IO"), val => \$cnx->{io} }), - if__($cnx->{io0}, { label => N("Card IO_0"), val => \$cnx->{io0} }), - if__($cnx->{io1}, { label => N("Card IO_1"), val => \$cnx->{io1} }), - if__($cnx->{phone_in}, { label => N("Your personal phone number"), val => \$cnx->{phone_in} }), - if__($netc->{DOMAINNAME2}, { label => N("Provider name (ex provider.net)"), val => \$netc->{DOMAINNAME2} }), - if__($cnx->{phone_out}, { label => N("Provider phone number"), val => \$cnx->{phone_out} }), - if__($netc->{dnsServer2}, { label => N("Provider dns 1 (optional)"), val => \$netc->{dnsServer2} }), - if__($netc->{dnsServer3}, { label => N("Provider dns 2 (optional)"), val => \$netc->{dnsServer3} }), - if__($cnx->{vpivci}, { label => N("Choose your country"), val => \$netc->{vpivci}, list => detect_timezone() }), - if__($cnx->{dialing_mode}, { label => N("Dialing mode"), val => \$cnx->{dialing_mode},list => ["auto", "manual"] }), - if__($cnx->{speed}, { label => N("Connection speed"), val => \$cnx->{speed}, list => ["64 Kb/s", "128 Kb/s"] }), - if__($cnx->{huptimeout}, { label => N("Connection timeout (in sec)"), val => \$cnx->{huptimeout} }), - { label => N("Account Login (user name)"), val => \$cnx->{login} }, - { label => N("Account Password"), val => \$cnx->{passwd}, hidden => 1 }, - ] - ) or return; - if ($netc->{vpivci}) { - foreach ([N("Netherlands"), '8_48'], [N("France"), '8_35'], [N("Belgium"), '8_35'], [N("Italy"), '8_35'], [N("United Kingdom"), '0_38'], [N("United States"), '8_35']) { - $netc->{vpivci} eq $_->[0] and $netc->{vpivci} = $_->[1]; - } - } - 1; -} - -sub detect_timezone() { - my %tmz2country = ( - 'Europe/Paris' => N("France"), - 'Europe/Amsterdam' => N("Netherlands"), - 'Europe/Rome' => N("Italy"), - 'Europe/Brussels' => N("Belgium"), - 'America/New_York' => N("United States"), - 'Europe/London' => N("United Kingdom") - ); - my %tm_parse = MDK::Common::System::getVarsFromSh('/etc/sysconfig/clock'); - my @country; - foreach (keys %tmz2country) { - if ($_ eq $tm_parse{ZONE}) { - unshift @country, $tmz2country{$_}; - } else { push @country, $tmz2country{$_} }; - } - \@country; -} - sub connected() { gethostbyname("mandrakesoft.com") ? 1 : 0 } # request a ref on a bg_connect and a ref on a scalar @@ -327,4 +243,9 @@ sub is_dynamic_ip { any { $_->{BOOTPROTO} !~ /^(none|static|)$/ } values %$intf; } +sub is_dynamic_host { + my ($intf) = @_; + any { defined $_->{DHCP_HOSTNAME} } values %$intf; +} + 1; -- cgit v1.2.1