diff options
author | Olivier Blin <oblin@mandriva.com> | 2007-05-25 15:39:46 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2007-05-25 15:39:46 +0000 |
commit | 1d37bfdbbe874abd6dcb5563eea19f531de09e1c (patch) | |
tree | 74845e43ed8fa59c7aaafd1a87efaa6b0c83c228 /lib/network/connection/cable.pm | |
parent | c6ba983db7d5a82ee63599e775be0f8211447c72 (diff) | |
download | drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.gz drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.bz2 drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.xz drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.zip |
sync with 2007.1 (because of SVN loss)2007.1
Diffstat (limited to 'lib/network/connection/cable.pm')
-rw-r--r-- | lib/network/connection/cable.pm | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/lib/network/connection/cable.pm b/lib/network/connection/cable.pm new file mode 100644 index 0000000..e74ac6a --- /dev/null +++ b/lib/network/connection/cable.pm @@ -0,0 +1,77 @@ +package network::connection::cable; + +use strict; +use common; + +use base qw(network::connection::ethernet); + +use strict; +use common; +use modules; +use detect_devices; + +sub get_type_name() { N("Cable") } +sub get_type_description() { N("Cable modem") } +sub get_type_icon() { 'cablemodem-24.png' } +sub get_metric { 20 } + +sub handles_ifcfg { + my ($_class, $_ifcfg) = @_; + 0; +} + +my $bpalogin_file = '/etc/bpalogin.conf'; + +sub guess_protocol { + my ($self) = @_; + $self->{protocol} = 'dhcp'; +} + +sub guess_access_settings { + my ($self) = @_; + $self->{access}{use_bpalogin} = -e $::prefix . $bpalogin_file; + if ($self->{access}{use_bpalogin}) { + foreach (cat_($::prefix . $bpalogin_file)) { + /^username (.*)/ and $self->{access}{login} = $1; + /^password (.*)/ and $self->{access}{password} = $1; + } + } +} + +sub get_access_settings { + my ($self) = @_; + my %auth = ( + 0 => N("None"), + 1 => N("Use BPALogin (needed for Telstra)"), + ); + [ + { label => N("Authentication"), type => "list", val => \$self->{access}{use_bpalogin}, + list => [ sort keys %auth ], format => sub { $auth{$_[0]} } }, + { label => N("Account Login (user name)"), val => \$self->{access}{login}, + disabled => sub { !$self->{access}{use_bpalogin} } }, + { label => N("Account Password"), val => \$self->{access}{password}, hidden => 1, + disabled => sub { !$self->{access}{use_bpalogin} } }, + ]; +} + +sub write_settings { + my ($self, $o_net, $o_modules_conf) = @_; + if ($self->{access}{use_bpalogin}) { + substInFile { + s/username\s+.*\n/username $self->{access}{login}\n/; + s/password\s+.*\n/password $self->{access}{password}\n/; + } $::prefix . $bpalogin_file; + } + services::set_status("bpalogin", $self->{access}{use_bpalogin}); + $self->SUPER::write_settings($o_net, $o_modules_conf); +} + +sub install_packages { + my ($self, $in) = @_; + if ($self->{access}{use_bpalogin}) { + $in->do_pkgs->ensure_is_installed('bpalogin', '/usr/sbin/bpalogin') or return; + } + $self->SUPER::install_packages($in); +} + +1; |