diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2004-01-27 11:20:32 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2004-01-27 11:20:32 +0000 |
commit | 9e625496348cb64995547038b3eb49e701f50091 (patch) | |
tree | 959416aa25161b2b190628cbc3c471f2b2491192 | |
parent | fcaf2f7055701959e9295f361a4210e677743f9d (diff) | |
download | drakx-9e625496348cb64995547038b3eb49e701f50091.tar drakx-9e625496348cb64995547038b3eb49e701f50091.tar.gz drakx-9e625496348cb64995547038b3eb49e701f50091.tar.bz2 drakx-9e625496348cb64995547038b3eb49e701f50091.tar.xz drakx-9e625496348cb64995547038b3eb49e701f50091.zip |
add a step in order to select a provider from kppp database
-rw-r--r-- | perl-install/network/netconnect.pm | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 1eb295015..5701154e7 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -89,6 +89,9 @@ sub get_subwizard { my ($module, $auto_ip, $onboot, $needhostname, $hotplug, $track_network_id, @fields); # lan config my $success = 1; my $ethntf = {}; + my $db_path = "/usr/share/apps/kppp/Provider"; + my (%countries, @isp, $country, $provider, $old_provider); + my %wireless_mode = (N("Ad-hoc") => "Ad-hoc", N("Managed") => "Managed", @@ -353,7 +356,7 @@ Take a look at http://www.linmodems.org"), post => sub { $ntf_name = $netc->{autodetect}{modem}{$modem_name}{device} || $netc->{autodetect}{modem}{$modem_name}{description}; - return "ppp_account" if $ntf_name =~ m!^/dev/!; + return "ppp_provider" if $ntf_name =~ m!^/dev/!; return "choose_serial_port" if !$ntf_name; my %relocations = (ltmodem => $in->do_pkgs->check_kernel_module_packages('ltmodem')); @@ -375,7 +378,7 @@ Take a look at http://www.linmodems.org"), #$type eq 'ltmodem' and $netc->{autodetect}{modem} = '/dev/ttyS14'; #- fallback to modem configuration (beware to never allow test it). - return "ppp_account"; + return "ppp_provider"; }, }, @@ -391,9 +394,44 @@ Take a look at http://www.linmodems.org"), [ { var => \$modem->{device}, format => \&mouse::serial_port2text, type => "list", list => [ grep { $_ ne $o_mouse->{device} } (if_(-e '/dev/modem', '/dev/modem'), mouse::serial_ports()) ] } ], }, - next => "ppp_account", + next => "ppp_provider", }, + + ppp_provider => + { + pre => sub { + @isp = map { + my $country = $_; + map { + s!$db_path/$country!!; + s/%([0-9]{3})/chr(int($1))/eg; + $countries{$country} ||= translate($country); + join('', $countries{$country}, $_); + } glob_("$db_path/$country/*") + } map { s!$db_path/!!o; s!_! !g; $_ } glob_("$db_path/*"); + $old_provider = $provider; + }, + name => N("Select your provider:"), + data => sub { + [ { label => N("Provider:"), type => "list", val => \$provider, separator => '/', list => \@isp } ] + }, + post => sub { + ($country, $provider) = split('/', $provider); + $country = { reverse %countries }->{$country}; + my %l = getVarsFromSh("$db_path/$country/$provider"); + if ($old_provider ne $provider) { + $modem->{connection} = $l{Name}; + $modem->{phone} = $l{Phonenumber}; + $modem->{auth} = $l{Authentication}; + $modem->{$_} = $l{$_} foreach qw(AutoName Domain Gateway IPAddr SubnetMask); + ($modem->{dns1}, $modem->{dns2}) = split(',', $l{DNS}); + } + return "ppp_account"; + }, + }, + + ppp_account => { pre => sub { |