From 21d632055bbe913d53c3324d7465a38621d6d79e Mon Sep 17 00:00:00 2001 From: damien Date: Sun, 22 Jul 2001 19:58:06 +0000 Subject: big work on isdn. Not finished --- perl-install/detect_devices.pm | 13 +++++++++++++ perl-install/modules.pm | 2 +- perl-install/network/isdn.pm | 29 +++++++++++++++++++++-------- perl-install/network/netconnect.pm | 1 - perl-install/network/tools.pm | 6 +++--- perl-install/standalone/net_monitor | 12 ++++++------ 6 files changed, 44 insertions(+), 19 deletions(-) diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 81a106098..a210515b5 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -190,9 +190,22 @@ sub getDAC960() { } sub getNet() { +# my @a; +# foreach (@netdevices) { +# $::isStandalone && /plip/ and next; +# print (" hhhhh $_ \n"); +# /ippp/ and run_program::rooted("", "/sbin/isdnctrl addif $_"); +# c::hasNetDevice($_) and push @a, $_; +# } +# /ippp/ and run_program::rooted("", "/sbin/isdnctrl delif $_") foreach @netdevices; +# @a; grep { !($::isStandalone && /plip/) && c::hasNetDevice($_) } @netdevices; } +#sub getISDN() { +# mapgrep(sub {member (($_[0] =~ /\s*(\w*):/), @netdevices), $1 }, split(/\n/, cat_("/proc/net/dev"))); +#} + sub pci_probe { my ($probe_type) = @_; map { diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 354665395..b11d87aa3 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -735,7 +735,7 @@ sub get_that_type { grep { if ($type eq 'isdn') { - my $b = $_->{driver} =~ /ISDN:(.*),?(.*)/; + my $b = $_->{driver} =~ /ISDN:([^,]*),?(.*)/; if ($b) { $_->{driver} = $1; $_->{options} = $2; diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm index f67c6aac1..d921ee204 100644 --- a/perl-install/network/isdn.pm +++ b/perl-install/network/isdn.pm @@ -1,6 +1,6 @@ package network::isdn; -use common qw(:common :file); +use common qw(:common :file :system); use any; use modules; use log; @@ -42,16 +42,18 @@ sub isdn_write_config { my $e = $in->ask_from_list_(_("Network Configuration Wizard"), _("Which ISDN configuration do you prefer? -* The full configuration uses isdn4net. It contains powerfull tools, but is tricky to configure for a newbie, and not standard. +* The Old configuration uses isdn4net. It contains powerfull tools, but is tricky to configure for a newbie, and not standard. -* The light configuration is easier to understand, more standard, but with less tools. +* The New configuration is easier to understand, more standard, but with less tools. We recommand the light configuration. -"), [ __("Light configuration"), __("Full configuration (isdn4net)")] +"), [ __("New configuration (isdn-light)"), __("Old configuration (isdn4net)")] ) or return; - $install->($e =~ /Light/ ? 'isdn-light' : 'isdn4net', 'isdn4k-utils'); - isdn_write_config_backend($isdn, $e =~ /Light/); + #FIXME debug only + system('urpmi --auto --best-output ' . join(' ', $e =~ /light/ ? 'isdn-light' : 'isdn4net', 'isdn4k-utils')); + #$install->($e =~ /light/ ? 'isdn-light' : 'isdn4net', 'isdn4k-utils'); + isdn_write_config_backend($isdn, $e =~ /light/); $::isStandalone and ask_connect_now($isdn, 'ippp0'); 1; } @@ -66,7 +68,12 @@ We recommand the light configuration. sub isdn_write_config_backend { my ($isdn, $light) = @_; if ($light) { - any::setup_thiskind($in, 'isdn', !$::expert, 1); + modules::mergein_conf("$prefix/etc/modules.conf"); + @c = any::setup_thiskind($in, 'isdn', !$::expert, 1); + modules::add_alias("ippp0", $c[0]{driver}); + isdn_detect_backend($isdn); + + $::isStandalone and modules::write_conf($prefix); foreach my $f ('ioptions1B', 'ioptions2B') { substInFile { s/^name .*\n//; $_ .= "name $isdn->{login}\n" if eof } "$prefix/etc/ppp/$f"; chmod 0600, $f; @@ -99,6 +106,7 @@ I4L_MEMBASE="$isdn->{mem}" I4L_PORT="$isdn->{io}" I4L_IO0="$isdn->{io0}" I4L_IO1="$isdn->{io1}" +I4L_ID="isdn_card" ); output "$prefix/etc/ppp/ioptions", @@ -212,6 +220,7 @@ sub isdn_detect { isdn_ask($isdn, $netc, _("I have detected an ISDN PCI Card, but I don't know the type. Please select one PCI card on the next screen.")) or return; } else { isdn_detect_step_1: + print "plop isdn protocol\n"; $isdn->{protocol}=isdn_ask_protocol() or return; isdn_detect_step_2: isdn_ask_info($isdn, $netc) or goto isdn_detect_step_1; @@ -236,7 +245,11 @@ sub isdn_detect_backend { $isdn->{$_} = $c->{$_} foreach qw(description vendor id driver options); $isdn->{$_} = sprintf("%0x", $isdn->{$_}) foreach ('vendor', 'id'); $isdn->{card_type} = 'pci'; - $isdn->{type} = $network::netconnect::isdnid2type{$isdn->{vendor} . $isdn->{id}}; #If the card is not listed, type is void. You have to ask it then. + ($isdn->{type}) = $isdn->{options} =~ /type=(\d+)/; + if ($c->{options} !~ /protocol/ && $isdn->{protocol}) { + $c->{options} .= "protocol=" . $isdn->{protocol}; + } + $c->{options} =~ /protocol=(\w+)/ and $isdn->{protocol} = $1; } } diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 36c319c7d..7e5e2a673 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -156,7 +156,6 @@ ifdown eth0 ); my $i=0; map { defined $set_default or do { $_->[1] and $set_default=$i; }; $i++; } @l; - foreach (keys %{$netc->{autodetect}}) { print "plop $_\n" }; my $e = $in->ask_from_entries_refH(_("Network Configuration Wizard"), _("Choose"), [ diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 3cbbfdcd2..aff57e9b1 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -1,6 +1,6 @@ package network::tools; -use common qw(:common :file); +use common qw(:common :file :system); use run_program; use vars qw(@ISA @EXPORT); use globals "network", qw($in $prefix $install $disconnect_file $connect_prog); @@ -11,8 +11,8 @@ use globals "network", qw($in $prefix $install $disconnect_file $connect_prog); sub write_secret_backend { my ($a, $b) = @_; - foreach ("pap-secrets", "chap-secrets") { - substInFile { s/^$a.*\n//; $_ .= "\n'$a' * '$b' * \n" if eof } "$prefix/etc/ppp/$_"; + foreach my $i ("pap-secrets", "chap-secrets") { + substInFile { s/^$a.*\n//; $_ .= "\n'$a' * '$b' * \n" if eof } "$prefix/etc/ppp/$i"; } } diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor index 54faa40d9..294265eb9 100755 --- a/perl-install/standalone/net_monitor +++ b/perl-install/standalone/net_monitor @@ -26,7 +26,7 @@ use my_gtk qw(:helpers :wrappers); #-use Data::Dumper; use common qw(:common :file :functional :system); use strict; -use netconnect; +use network::netconnect; my ($connect, $default_intf); init Gtk; @@ -110,16 +110,16 @@ sub connection { my $tag2 = Gtk->timeout_add(10000, sub { Gtk->timeout_remove($tag); $statusbar->pop(1); - $statusbar->push(1, $isconnected2 ? ( netconnect::connected('', $netc) ? + $statusbar->push(1, $isconnected2 ? ( network::netconnect::connected('', $netc) ? _("Disconnection from Internet failed.") : _("Disconnection from Internet complete.")) : - ( netconnect::connected('', $netc) ? + ( network::netconnect::connected('', $netc) ? _("Connection complete.") : _("Connection failed.\nVerify your configuration in the Mandrake Control Center.")) ); my $tag3 = Gtk->timeout_add(10000, sub { $statusbar->pop(1); - $statusbar->push(1, netconnect::connected('', $netc) ? _("Connected") : _("Not connected")); + $statusbar->push(1, network::netconnect::connected('', $netc) ? _("Connected") : _("Not connected")); 0; }); $button_connect->set_sensitive(1); @@ -217,11 +217,11 @@ sub update { } @interfaces = @intfs; my $netc={}; - if(netconnect::connected('', $netc) == !$isconnected) { + if(network::netconnect::connected('', $netc) == !$isconnected) { $isconnected = $isconnected ? 0 : 1; $label_c->set($isconnected ? _("Disconnect") : _("Connect")); $statusbar->pop(1); - $statusbar->push(1, netconnect::connected('', $netc) ? _("Connected") : _("Not connected")); + $statusbar->push(1, network::netconnect::connected('', $netc) ? _("Connected") : _("Not connected")); $isconnected ? $pix_c->set($pix_c_map, $pix_c_mask) : $pix_c->set($pix_d_map, $pix_d_mask); } $time_tag2 = Gtk->timeout_add(5000, \&update); -- cgit v1.2.1