diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/network/adsl.pm | 27 | ||||
-rw-r--r-- | perl-install/network/ethernet.pm | 29 | ||||
-rw-r--r-- | perl-install/network/isdn.pm | 32 | ||||
-rw-r--r-- | perl-install/network/modem.pm | 15 | ||||
-rw-r--r-- | perl-install/network/netconnect.pm | 18 | ||||
-rw-r--r-- | perl-install/network/tools.pm | 13 |
6 files changed, 65 insertions, 69 deletions
diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm index 5f3dd5db1..48a05dfa5 100644 --- a/perl-install/network/adsl.pm +++ b/perl-install/network/adsl.pm @@ -83,20 +83,6 @@ sub adsl_conf { 1; } -#- adsl_conf_backend : write adsl configuration -#- input : -#- $adsl -#- $netc -#- $adsl_type : type of cnx : string : "pptp" or "pppoe" -#- $adsl input: -#- $adsl->{login}, $adsl->{passwd}, $adsl->{atboot} -#- $netc input: -#- $netc->{NET_DEVICE} -#- $netc->{dnsServer2} -#- $netc->{dnsServer3} -#- $netc->{DOMAINNAME2} -#- $netc output: -#- $netc->{NET_INTERFACE} is set to "ppp0" sub adsl_conf_backend { my ($adsl, $netc, $adsl_type) = @_; @@ -125,8 +111,8 @@ lock } "$prefix/etc/ppp/pppoe.conf"; } - output ("$prefix$connect_file", - $adsl_type eq 'pptp' ? + write_cnx_script($netc, "adsl", + $adsl_type eq 'pptp' ? "#!/bin/bash /sbin/route del default /usr/bin/pptp 10.0.0.138 name $adsl->{login} @@ -135,10 +121,9 @@ lock "#!/bin/bash /sbin/route del default LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C /usr/sbin/adsl-start $netc->{NET_DEVICE} $adsl->{login} -"); - output ("$prefix$disconnect_file", - $adsl_type eq 'pptp' ? - "#!/bin/bash +", + $adsl_type eq 'pptp' ? +"#!/bin/bash /usr/bin/killall pptp pppd " : @@ -146,8 +131,6 @@ LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C /usr/sbin/adsl-start $netc->{NET_DEVICE /usr/sbin/adsl-stop /usr/bin/killall pppoe pppd "); - chmod 0755, "$prefix$disconnect_file"; - chmod 0755, "$prefix$connect_file"; if ($adsl->{atboot}) { output ("$prefix/etc/rc.d/init.d/adsl", diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index e61cf907f..db7c6d376 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -6,8 +6,9 @@ use any; use detect_devices; use common; use run_program; +use network::tools; use vars qw(@ISA @EXPORT); -use MDK::Common::Globals "network", qw($in $prefix $install $connect_file $disconnect_file); +use MDK::Common::Globals "network", qw($in $prefix $install); @ISA = qw(Exporter); @EXPORT = qw(configureNetwork conf_network_card conf_network_card_backend go_ethernet); @@ -66,19 +67,16 @@ sub configure_lan { $netcnx->{NET_DEVICE} = $netc->{NET_DEVICE} = ''; $netcnx->{NET_INTERFACE} = 'lan'; #$netc->{NET_INTERFACE}; } - output "$prefix$connect_file", - qq( + write_cnx_script($netc, "local network", +qq( #!/bin/bash /etc/rc.d/init.d/network restart -); - output "$prefix$disconnect_file", - qq( +), +qq( #!/bin/bash /etc/rc.d/init.d/network stop /sbin/ifup lo -); - chmod 0755, "$prefix$disconnect_file"; - chmod 0755, "$prefix$connect_file"; +)); $::isStandalone and modules::write_conf($prefix); 1; } @@ -168,18 +166,15 @@ sub go_ethernet { conf_network_card($netc, $intf, $type, $ipadr, $netadr) or return; $netc->{NET_INTERFACE}=$netc->{NET_DEVICE}; configureNetwork($netc, $intf, $first_time) or return; - output "$prefix$connect_file", - qq( + write_cnx_script($netc, "Local network", +qq( #!/bin/bash ifup $netc->{NET_DEVICE} -); - output "$prefix$disconnect_file", - qq( +), +qq( #!/bin/bash ifdown $netc->{NET_DEVICE} -); - chmod 0755, "$prefix$disconnect_file"; - chmod 0755, "$prefix$connect_file"; +)); if ( $::isStandalone and $netc->{NET_DEVICE}) { $in->ask_yesorno(_("Network interface"), _("I'm about to restart the network device $netc->{NET_DEVICE}. Do you agree?"), 1) and system("$prefix/sbin/ifdown $netc->{NET_DEVICE}; $prefix/sbin/ifup $netc->{NET_DEVICE}"); diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm index a97710963..d1e326e20 100644 --- a/perl-install/network/isdn.pm +++ b/perl-install/network/isdn.pm @@ -7,7 +7,7 @@ use modules; use log; use network::tools; use vars qw(@ISA @EXPORT); -use MDK::Common::Globals "network", qw($in $prefix $install; $connect_file $disconnect_file); +use MDK::Common::Globals "network", qw($in $prefix $install); @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); @@ -38,7 +38,7 @@ sub configure { } sub isdn_write_config { - my ($isdn) = @_; + my ($isdn, $netc) = @_; isdn_write_config_step_1: my $e = $in->ask_from_list_(_("Network Configuration Wizard"), _("Which ISDN configuration do you prefer? @@ -52,15 +52,15 @@ We recommand the light configuration. "), [ __("New configuration (isdn-light)"), __("Old configuration (isdn4net)")] ) or return; #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/); + #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/, $netc); $::isStandalone and ask_connect_now($isdn, 'ippp0'); 1; } sub isdn_write_config_backend { - my ($isdn, $light) = @_; + my ($isdn, $light, $netc) = @_; if ($light) { modules::mergein_conf("$prefix/etc/modules.conf"); if ($isdn->{id}) { @@ -121,20 +121,16 @@ defaultroute write_secret_backend($isdn->{login}, $isdn->{passwd}); - output "$prefix$connect_file", - "#!/bin/bash + write_cnx_script($netc, "isdn", +"#!/bin/bash /sbin/route del default /sbin/ifup ippp0 /sbin/isdnctrl dial ippp0 -"; - - output "$prefix$disconnect_file", - "#!/bin/bash +", +"#!/bin/bash /sbin/isdnctrl hangup ippp0 /sbin/ifdown ippp0 -"; - chmod 0755, "$prefix$disconnect_file"; - chmod 0755, "$prefix$connect_file"; +"); 1; } @@ -203,13 +199,13 @@ If you have a PCMCIA card, you have to know the irq and io of your card. _("Which is your ISDN card ?"), sub { $_[0]{description} }, [ grep {$_->{card} eq $isdn->{card_type}; } @isdndata ] ) or goto isdn_ask_step_1; - $e->{$_} and $isdn->{$_} = $e->{$_} foreach qw(driver type mem io io0 io1 irq); + $e->{$_} and $isdn->{$_} = $e->{$_} foreach qw(driver type mem io io0 io1 irq firmware); isdn_ask_step_3: $isdn->{protocol} = isdn_ask_protocol() or goto isdn_ask_step_2; isdn_ask_step_4: isdn_ask_info($isdn, $netc) or goto isdn_ask_step_3; - isdn_write_config($isdn) or goto isdn_ask_step_4; + isdn_write_config($isdn, $netc) or goto isdn_ask_step_4; 1; } @@ -225,7 +221,7 @@ sub isdn_detect { $isdn->{protocol}=isdn_ask_protocol() or return; isdn_detect_step_2: isdn_ask_info($isdn, $netc) or goto isdn_detect_step_1; - isdn_write_config($isdn) or goto isdn_detect_step_2; + isdn_write_config($isdn, $netc) or goto isdn_detect_step_2; } } else { isdn_ask($isdn, $netc, _("No ISDN PCI card found. Please select one on the next screen.")) or return; diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm index fea6d0903..aae50b068 100644 --- a/perl-install/network/modem.pm +++ b/perl-install/network/modem.pm @@ -7,7 +7,7 @@ use detect_devices; use mouse; use network::tools; use vars qw(@ISA @EXPORT); -use MDK::Common::Globals "network", qw($in $prefix $install $connect_file $disconnect_file); +use MDK::Common::Globals "network", qw($in $prefix $install); @ISA = qw(Exporter); @EXPORT = qw(pppConfig modem_detect_backend); @@ -19,17 +19,14 @@ sub configure{ $netcnx->{modem}{device}=$netc->{autodetect}{modem}; modem_step_1: pppConfig($netcnx->{$netcnx->{type}}, $mouse, $netc) or return; - output "$prefix$connect_file", - q(#!/bin/bash + write_cnx_script($netc, "modem", +q(#!/bin/bash ifup ppp0 -); - output "$prefix$disconnect_file", - q(#!/bin/bash +), +q(#!/bin/bash ifdown ppp0 killall pppd -); - chmod 0755, "$prefix$disconnect_file"; - chmod 0755, "$prefix$connect_file"; +)); if ($::isStandalone) { ask_connect_now($netcnx->{$netcnx->{type}}, 'ppp0') or goto modem_step_1 } 1; } diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 9d83fb934..72098b3fb 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -144,12 +144,15 @@ ifdown eth0 } step_2: + my $set_default; my %conf; + $conf{$_} = $netc->{autodetect}{$_} ? 1 : 0 foreach qw(modem adsl cable lan); + $conf{isdn} = $netc->{autodetect}{isdn}{description} ? 1: 0; my @l = ( [_("Normal modem connection"), $netc->{autodetect}{modem}, __("detected on port %s"), \$conf{modem}], [_("ISDN connection"), $netc->{autodetect}{isdn}{description}, __("detected %s"), \$conf{isdn}], - [_("DSL (or ADSL) connection"), $netc->{autodetect}{adsl}, __("detected on interface %s"), \$conf{adsl}], + [_("ADSL connection"), $netc->{autodetect}{adsl}, __("detected on interface %s"), \$conf{adsl}], [_("Cable connection"), $netc->{autodetect}{cable}, __("cable connection detected"), \$conf{cable}], [_("LAN connection"), $netc->{autodetect}{lan}, __("ethernet card(s) detected"), \$conf{lan}] ); @@ -172,6 +175,19 @@ ifdown eth0 $conf{cable} and do { require network::ethernet; network::ethernet::configure_cable($netcnx, $netc, $intf, $first_time) or goto step_2 }; $conf{lan} and do { require network::ethernet; network::ethernet::configure_lan($netcnx, $netc, $intf, $first_time) or goto step_2 }; + if (keys %{$netc->{internet_cnx}} > 1) { + $in->ask_from_entries_refH(_("Network Configuration Wizard"), + _("You have configured multiple ways to connect to the Internet.\nChoose the one you want to use.\n\n" . if_(!$::isStandalone, "You may want to configure some profiles after the installation, in the Mandrake Control Center")), + [ + { label => _("Internet connection"), val => [$netc->{internet_cnx_choice}], list => [ keys %{$netc->{internet_cnx}}]}, + ] + ) or goto step_2; + } elsif (keys %{$netc->{internet_cnx}} == 1) { + $netc->{internet_cnx_choice} = $netc->{internet_cnx}[1]; + } + print " - --------- -- - -------\n" . $netc->{internet_cnx_choice} . "------------\n"; + $netc->{internet_cnx_choice} and write_cnx_script($netc); + step_3: my $m = _("Congratulation, The network and internet configuration is finished. diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 6cf4f8f3a..851569e6d 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -3,12 +3,21 @@ package network::tools; use common; use run_program; use vars qw(@ISA @EXPORT); -use MDK::Common::Globals "network", qw($in $prefix $install $disconnect_file $connect_prog); +use MDK::Common::Globals "network", qw($in $prefix $install $disconnect_file $connect_prog $connect_file $disconnect_file); @ISA = qw(Exporter); -@EXPORT = qw(write_secret_backend ask_connect_now connect_backend disconnect_backend read_providers_backend ask_info2 connected disconnected); +@EXPORT = qw(write_cnx_script write_secret_backend ask_connect_now connect_backend disconnect_backend read_providers_backend ask_info2 connected disconnected); @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); + foreach ([$connect_file, $up], [$disconnect_file, $down]) { + $netc->{internet_cnx}{$type}{$_->[0]}=$_->[1]; + chmod 0755, "$prefix" . $_->[0]; + } +} + sub write_secret_backend { my ($a, $b) = @_; foreach my $i ("pap-secrets", "chap-secrets") { |