summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/ethernet.pm4
-rw-r--r--perl-install/network/isdn.pm6
-rw-r--r--perl-install/network/modem.pm6
-rw-r--r--perl-install/network/netconnect.pm3
-rw-r--r--perl-install/network/tools.pm62
5 files changed, 65 insertions, 16 deletions
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm
index 74a23a029..e6f80a678 100644
--- a/perl-install/network/ethernet.pm
+++ b/perl-install/network/ethernet.pm
@@ -48,11 +48,9 @@ Default is dhcpcd"),
go_ethernet($netc, $intf, 'dhcp', '', '', $first_time);
write_cnx_script($netc, "cable",
qq(
-#!/bin/bash
/sbin/ifup $netc->{NET_DEVICE}
),
qq(
-#!/bin/bash
/sbin/ifdown $netc->{NET_DEVICE}
));
}
@@ -76,11 +74,9 @@ sub configure_lan {
$netcnx->{NET_INTERFACE} = 'lan'; #$netc->{NET_INTERFACE};
write_cnx_script($netc, "local network",
qq(
-#!/bin/bash
/etc/rc.d/init.d/network restart
),
qq(
-#!/bin/bash
/etc/rc.d/init.d/network stop
/sbin/ifup lo
));
diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm
index 0c9b07ca8..a837bbd9e 100644
--- a/perl-install/network/isdn.pm
+++ b/perl-install/network/isdn.pm
@@ -136,14 +136,12 @@ defaultroute
write_secret_backend($isdn->{login}, $isdn->{passwd});
write_cnx_script($netc, "isdn",
-"#!/bin/bash
-/sbin/route del default
+"/sbin/route del default
/sbin/ifup ippp0
/sbin/isdnctrl dial ippp0
" . if_($isdn->{speed} =~ /128/, "service ibod restart
"),
-"#!/bin/bash
-/sbin/isdnctrl hangup ippp0
+"/sbin/isdnctrl hangup ippp0
/sbin/ifdown ippp0
" . if_($isdn->{speed} =~ /128/, "service ibod stop
"));
diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm
index b529d2357..893a68119 100644
--- a/perl-install/network/modem.pm
+++ b/perl-install/network/modem.pm
@@ -20,11 +20,9 @@ sub configure{
modem_step_1:
pppConfig($netcnx->{$netcnx->{type}}, $mouse, $netc) or return;
write_cnx_script($netc, "modem",
-q(#!/bin/bash
-ifup ppp0
+q(ifup ppp0
),
-q(#!/bin/bash
-ifdown ppp0
+q(ifdown ppp0
killall pppd
));
1;
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index b8b327bde..bae9dc97b 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -133,12 +133,10 @@ Click on Ok to keep your configuration, or cancel to reconfigure your Internet &
"), 1)) and do {
output "$prefix$connect_file",
qq(
-#!/bin/bash
ifup eth0
);
output "$prefix$disconnect_file",
qq(
-#!/bin/bash
ifdown eth0
);
chmod 0755, "$prefix$disconnect_file";
@@ -211,6 +209,7 @@ ifdown eth0
} elsif ($nb == 1) {
$netc->{internet_cnx_choice} = (keys %{$netc->{internet_cnx}})[0];
}
+ $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);
} else {
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index 815ed5436..834d818e7 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -10,8 +10,11 @@ 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$_", $netc->{internet_cnx}{$netc->{internet_cnx_choice}}{$_}) foreach ($connect_file, $disconnect_file);
+ my ($netc, $type, $up, $down) = @_;
+ $type or 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];
@@ -78,6 +81,7 @@ sub ask_info2 {
if__($cnx->{phone_out}, { label => _("Provider phone number"), val => \$cnx->{phone_out} }),
if__($netc->{dnsServer2}, { label => _("Provider dns 1 (optional)"), val => \$netc->{dnsServer2} }),
if__($netc->{dnsServer3}, { label => _("Provider dns 2 (optional)"), val => \$netc->{dnsServer3} }),
+ if__($netc->{vcivpi}, { label => _("Choose your country"), val => \$netc->{vcivpi}, list => ['Netherlands', 'France', 'Belgium', 'Italy', 'UK'] }),
if__($cnx->{dialing_mode}, { label => _("Dialing mode"), val => \$cnx->{dialing_mode},list=>["auto","manual"]}),
if__($cnx->{speed}, { label => _("Connection speed"), val => \$cnx->{speed}, list => ["64 Kb/s", "128 Kb/s"]}),
if__($cnx->{huptimeout}, { label => _("Connection timeout (in sec)"), val => \$cnx->{huptimeout} }),
@@ -85,6 +89,11 @@ sub ask_info2 {
if__($cnx->{passwd}, { label => _("Account Password"), val => \$cnx->{passwd} }),
]
) or return;
+ if ($netc->{vcivpi}) {
+ foreach (['Netherlands', 8.48], ['France', 8.35], ['Belgium', 8.35], ['Italy', 8.35], ['UK', 0.38]) {
+ $netc->{vcivpi} eq $_->[0] and $netc->{vcivpi} = $_->[1] ;
+ }
+ }
1;
}
@@ -102,3 +111,52 @@ sub type2interface {
sub connected { gethostbyname("www.mandrakesoft.com") ? 1 : 0 }
sub disconnected { }
+
+
+sub write_initscript {
+ output ("$prefix/etc/rc.d/init.d/internet",
+ qq{
+#!/bin/bash
+#
+# internet Bring up/down internet connection
+#
+# chkconfig: 2345 11 89
+# description: Activates/Deactivates the internet interfaces
+#
+# dam's damien@mandrakesoft.com
+
+ case "$1" in
+ start)
+ echo -n "Checking internet connections to start at boot: "
+ $connect_file --boot_time
+ touch /var/lock/subsys/internet
+ echo -n internet
+ echo
+ ;;
+ stop)
+ echo -n "Stopping internet connection if needed: "
+ $disconnect_file
+ echo -n internet
+ echo
+ rm -f /var/lock/subsys/internet
+ ;;
+ restart)
+ $0 stop
+ echo -n "Waiting 10 sec before restarting the internet connection."
+ sleep 10
+ $0 start
+ ;;
+ status)
+ ;;
+ *)
+ echo "Usage: internet {start|stop|status|restart}"
+ exit 1
+esac
+exit 0
+ });
+ chmod 0755, "$prefix/etc/rc.d/init.d/internet";
+ $::isStandalone ? system("/sbin/chkconfig --add internet") : do {
+ symlinkf ("../init.d/internet", "$prefix/etc/rc.d/rc$_") foreach
+ '0.d/K11internet', '1.d/K11internet', '2.d/K11internet', '3.d/S89internet', '5.d/S89internet', '6.d/K11internet';
+ };
+}