summaryrefslogtreecommitdiffstats
path: root/perl-install/network/isdn.pm
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-12-06 11:01:59 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-12-06 11:01:59 +0000
commitb8c50cf70eb80b5bcaedcaf6117549ff83bc36cd (patch)
treec8e340107a55c3b52c8d476a8cb613655c00856b /perl-install/network/isdn.pm
parent9209a6b92d9c5a84e588f401aca4a1b17f43650e (diff)
downloaddrakx-b8c50cf70eb80b5bcaedcaf6117549ff83bc36cd.tar
drakx-b8c50cf70eb80b5bcaedcaf6117549ff83bc36cd.tar.gz
drakx-b8c50cf70eb80b5bcaedcaf6117549ff83bc36cd.tar.bz2
drakx-b8c50cf70eb80b5bcaedcaf6117549ff83bc36cd.tar.xz
drakx-b8c50cf70eb80b5bcaedcaf6117549ff83bc36cd.zip
isdn data are now fetched form system instead of drakconnect conf file
Diffstat (limited to 'perl-install/network/isdn.pm')
-rw-r--r--perl-install/network/isdn.pm104
1 files changed, 82 insertions, 22 deletions
diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm
index a5c45d7cf..88a6fc013 100644
--- a/perl-install/network/isdn.pm
+++ b/perl-install/network/isdn.pm
@@ -10,27 +10,43 @@ use network::tools;
use vars qw(@ISA @EXPORT);
use MDK::Common::Globals "network", qw($in $prefix);
use MDK::Common::File;
+use Data::Dumper;
@ISA = qw(Exporter);
@EXPORT = qw(isdn_write_config isdn_write_config_backend get_info_providers_backend isdn_ask_info isdn_ask_protocol isdn_ask isdn_detect isdn_detect_backend isdn_get_list isdn_get_info);
sub configure {
- my ($netcnx, $netc) = @_;
+ my ($netcnx, $netc, $isdn) = @_;
isdn_step_1:
defined $netc->{autodetect}{isdn}{id} and goto intern_pci;
$::isInstall and $in->set_help('configureNetworkISDN');
my $e = $in->ask_from_list_(N("Network Configuration Wizard"),
- N("What kind is your ISDN connection?"), [ N_("Internal ISDN card"), N_("External ISDN modem") ]
+ N("Which ISDN configuration do you prefer?
+
+* The Old configuration uses isdn4net. It contains powerful
+ tools, but is tricky to configure, and not standard.
+
+* The New configuration is easier to understand, more
+ standard, but with less tools.
+
+We recommand the light configuration.
+"), [ N_("New configuration (isdn-light)"), N_("Old configuration (isdn4net)") ]
) or return;
+ $netc->{autodetect}{isdn}{is_light} = $e =~ /light/ ? 1 : undef;
+ $e = $in->ask_from_list_(N("Network Configuration Wizard"),
+ N("What kind is your ISDN connection?"), [ N_("Internal ISDN card"), N_("External ISDN modem") ]
+ ) or return;
+
if ($e =~ /card/) {
intern_pci:
$netc->{isdntype} = 'isdn_internal';
- $netcnx->{isdn_internal} = {};
- $netcnx->{isdn_internal}{$_} = $netc->{autodetect}{isdn}{$_} foreach 'description', 'vendor', 'id', 'driver', 'card_type', 'type';
+ $netcnx->{isdn_internal} = isdn_read_config($isdn);
+ $netcnx->{isdn_internal}{$_} = $netc->{autodetect}{isdn}{$_} foreach 'description', 'vendor', 'id', 'driver', 'card_type', 'type', 'is_light';
isdn_detect($netcnx->{isdn_internal}, $netc) or return;
} else {
$netc->{isdntype} = 'isdn_external';
- $netcnx->{isdn_external} = {};
+ $netcnx->{isdn_external} = isdn_read_config($isdn);
$netcnx->{isdn_external}{device} = $netc->{autodetect}{modem};
+ $netcnx->{isdn_external}{is_light} = $netc->{autodetect}{isdn}{is_light};
$netcnx->{isdn_external}{special_command} = 'AT&F&O2B40';
require network::modem;
network::modem::pppConfig($netcnx->{isdn_external}, undef, $netc) or goto isdn_step_1;
@@ -41,19 +57,7 @@ sub configure {
sub isdn_write_config {
my ($isdn, $netc) = @_;
isdn_write_config_step_1:
- my $e = $in->ask_from_list_(N("Network Configuration Wizard"),
- N("Which ISDN configuration do you prefer?
-
-* The Old configuration uses isdn4net. It contains powerful
- tools, but is tricky to configure, and not standard.
-
-* The New configuration is easier to understand, more
- standard, but with less tools.
-
-We recommand the light configuration.
-"), [ N_("New configuration (isdn-light)"), N_("Old configuration (isdn4net)") ]
- ) or return;
- my ($rmpackage, $instpackage) = $e =~ /light/ ? ('isdn4net', 'isdn-light') : ('isdn-light', 'isdn4net');
+ my ($rmpackage, $instpackage) = $isdn->{is_light} ? ('isdn4net', 'isdn-light') : ('isdn-light', 'isdn4net');
if (!$::isStandalone) {
require pkgs;
my $p = pkgs::packageByName($in->{packages}, $rmpackage);
@@ -61,15 +65,14 @@ We recommand the light configuration.
}
run_program::rooted($prefix, "rpm", "-e", $rmpackage);
$in->do_pkgs->install($instpackage, if_($isdn->{speed} =~ /128/, 'ibod'), 'isdn4k-utils');
- my $light = $e =~ /light/ ? 1 : 0;
- isdn_write_config_backend($isdn, $light, $netc);
+ isdn_write_config_backend($isdn, $netc);
1;
}
sub isdn_write_config_backend {
- my ($isdn, $light, $netc, $netcnx) = @_;
+ my ($isdn, $netc, $netcnx) = @_;
defined $netcnx and $netc->{isdntype} = $netcnx->{type};
- if ($light) {
+ if ($isdn->{is_light}) {
modules::mergein_conf("$prefix/etc/modules.conf");
if ($isdn->{id}) {
isdn_detect_backend($isdn);
@@ -146,6 +149,63 @@ defaultroute
1;
}
+sub isdn_read_config {
+ my ($isdn) = @_;
+
+ if ($isdn->{is_light}) {
+ my $c = modules::read_conf("/etc/modules.conf");
+ $isdn->{driver} = $c->{ippp0}{alias};
+ #- 'type' 'protocol' 'mem' 'io' 'io0' 'io1' 'irq' 'id'
+ foreach (split(' ', $c->{$isdn->{driver}}{options})) {
+ /(.*)=(.*)/;
+ $isdn->{$1} = $2;
+ }
+ ;
+ foreach my $f ('ioptions1B', 'ioptions2B') {
+ foreach (cat_ ("$prefix/etc/ppp/$f")) {
+ if (/^\s*name\s*(.*)/) {
+ $isdn->{login} = $1;
+ goto NEXT;
+ }
+ }
+ }
+ NEXT :
+ foreach my $f ('isdn1B.conf', 'isdn2B.conf') {
+ foreach (cat_ ("$prefix/etc/isdn/$f")) {
+ /^\s*EAZ\s*=\s*(.*)/ and $isdn->{phone_in} = $1;
+ /^\s*PHONE_OUT\s*=\s*(.*)/ and $isdn->{phone_out} = $1;
+ if (/^\s*NAME\s*=\s*ippp0/ .. /PPPBIND\s*=\s*0/) {
+ /^\s*HUPTIMEOUT\s*=\s*(.*)/ and $isdn->{huptimeout} = $1;
+ }
+ }
+ }
+ } else {
+ my %match = (I4L_USERNAME => login,
+ I4L_LOCALMSN => phone_in,
+ I4L_REMOTE_OUT => phone_out,
+ I4L_DIALMODE => dialing_mode,
+ I4L_MODULE => driver,
+ I4L_TYPE => type,
+ I4L_IRQ => irq,
+ I4L_MEMBASE => mem,
+ I4L_PORT => io,
+ I4L_IO0 => io0,
+ I4L_IO1 => io1,
+ I4L_FIRMWARE => firmware);
+ foreach ('link/myisp', 'card/mycard') {
+ my %conf = getVarsFromSh("$prefix/etc/isdn/profile/$_");
+ foreach (keys %conf) {
+ $isdn->{$match{"$_"}} = $conf{"$_"} if $match{$_};
+ }
+ }
+ }
+ $isdn->{passwd} = network::tools::passwd_by_login($isdn->{login});
+ #$isdn->{description} = '';
+ #$isdn->{vendor} = '';
+ #$isdn->{passwd2} = '';
+ $isdn;
+}
+
sub get_info_providers_backend {
my ($isdn, $_netc, $name, $file) = @_;
$name eq 'Unlisted - edit manually' and return;