From 8fbd7ec2b17cefc2ab1edbd728fddb98bcadc480 Mon Sep 17 00:00:00 2001 From: damien Date: Wed, 12 Sep 2001 17:15:36 +0000 Subject: new default connection handling --- perl-install/network/adsl.pm | 6 +++--- perl-install/network/ethernet.pm | 4 ++-- perl-install/network/isdn.pm | 2 +- perl-install/network/modem.pm | 2 +- perl-install/network/netconnect.pm | 3 ++- perl-install/network/tools.pm | 16 ++++++++++------ 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm index bfb12b09c..f60deff05 100644 --- a/perl-install/network/adsl.pm +++ b/perl-install/network/adsl.pm @@ -149,19 +149,19 @@ and copy the mgmt.o in /usr/share/speedtouch')) /usr/bin/pptp 10.0.0.138 name $adsl->{login} ", '/usr/bin/killall pptp pppd -' ) } elsif ($adsl_type eq 'pppoe') { +', $netcnx->{type}) } elsif ($adsl_type eq 'pppoe') { write_cnx_script($netc, "adsl", "/sbin/route del default LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C /usr/sbin/adsl-start $netc->{NET_DEVICE} $adsl->{login} ", '/usr/sbin/adsl-stop /usr/bin/killall pppoe pppd -' ) } elsif ($adsl_type eq 'speedtouch') { +', $netcnx->{type}) } elsif ($adsl_type eq 'speedtouch') { write_cnx_script($netc, 'adsl', '/usr/share/speedtouch/speedtouch.sh start ', '/usr/share/speedtouch/speedtouch.sh stop -') } +', $netcnx->{type}) } $netc->{NET_INTERFACE}='ppp0'; } diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 7becd4a69..ba1dbbfbc 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -52,7 +52,7 @@ qq( ), qq( /sbin/ifdown $netc->{NET_DEVICE} -)); +), $netcnx->{type}); 1; } @@ -80,7 +80,7 @@ qq( qq( /etc/rc.d/init.d/network stop /sbin/ifup lo -)); +), $netcnx->{type}); } $::isStandalone and modules::write_conf($prefix); 1; diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm index a837bbd9e..006cbca23 100644 --- a/perl-install/network/isdn.pm +++ b/perl-install/network/isdn.pm @@ -144,7 +144,7 @@ defaultroute "/sbin/isdnctrl hangup ippp0 /sbin/ifdown ippp0 " . if_($isdn->{speed} =~ /128/, "service ibod stop -")); +"), $netcnx->{type}); 1; } diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm index 274a39530..6fb48ae78 100644 --- a/perl-install/network/modem.pm +++ b/perl-install/network/modem.pm @@ -24,7 +24,7 @@ q(ifup ppp0 ), q(ifdown ppp0 killall pppd -)); +), $netcnx->{type}); 1; } diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 6c11a0e22..03be12866 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -223,6 +223,7 @@ ifdown eth0 $netc->{at_boot} = $in->ask_yesorno(_("Network Configuration Wizard"), _("Do you want to start the connection at boot?")); if ($netc->{internet_cnx_choice} ) { write_cnx_script($netc); + $netcnx->{type} = $netc->{internet_cnx}{$netc->{internet_cnx_choice}}{type}; } else { unlink "$prefix/etc/sysconfig/network-scripts/net_cnx_up"; unlink "$prefix/etc/sysconfig/network-scripts/net_cnx_down"; @@ -397,7 +398,7 @@ PPPAuthentication=$modem->{auth} PPPSpecialCommand=" . ($netcnx->{type} eq 'isdn_external' ? $netcnx->{isdn_external}{special_command} : '' ) . " ADSLInterfacesList= -ADSLModem=" . q(# Obsolete information. Please don't use it.) . " +ADSLModem=" . q( # Obsolete information. Please don't use it.) . " ADSLType=" . ($netcnx->{type} =~ /adsl/ ? $netcnx->{type} : '') . " ADSLProviderDomain=$netc->{DOMAINNAME2} ADSLProviderDNS1=$netc->{dnsServer2} diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 9fede9a88..8acd00396 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -10,14 +10,18 @@ use MDK::Common::Globals "network", qw($in $prefix $disconnect_file $connect_pro @EXPORT_OK = qw($in); sub write_cnx_script { - my ($netc, $type, $up, $down) = @_; - $type or output ("$prefix$_", + my ($netc, $type, $up, $down, $type2) = @_; + if ($type) { + $netc->{internet_cnx}{$type}{$_->[0]}=$_->[1] foreach ([$connect_file, $up], [$disconnect_file, $down]); + $netc->{internet_cnx}{$type}{type} = $type2; + } else { + foreach ($connect_file, $disconnect_file) { + output ("$prefix$_", '#!/bin/bash ' . if_(!$netc->{at_boot}, 'if [ "x$1" == "x--boot_time" ]; then exit; fi -') . $netc->{internet_cnx}{$netc->{internet_cnx_choice}}{$_}) foreach ($connect_file, $disconnect_file); - foreach ([$connect_file, $up], [$disconnect_file, $down]) { - $netc->{internet_cnx}{$type}{$_->[0]}=$_->[1]; - chmod 0755, "$prefix" . $_->[0]; +') . $netc->{internet_cnx}{$netc->{internet_cnx_choice}}{$_}); + chmod 0755, "$prefix" . $_; + } } } -- cgit v1.2.1