summaryrefslogtreecommitdiffstats
path: root/perl-install/network/netconnect.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-01-19 22:41:53 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-01-19 22:41:53 +0000
commit22df0a00848e1b1d6fbd94dd85fa603a56f8fbcc (patch)
treef019e1c597c8acf0633e8aa798358dbbca36f6c9 /perl-install/network/netconnect.pm
parent2ae3ed534f40f1360184192a7f27be9d21839ee2 (diff)
downloaddrakx-22df0a00848e1b1d6fbd94dd85fa603a56f8fbcc.tar
drakx-22df0a00848e1b1d6fbd94dd85fa603a56f8fbcc.tar.gz
drakx-22df0a00848e1b1d6fbd94dd85fa603a56f8fbcc.tar.bz2
drakx-22df0a00848e1b1d6fbd94dd85fa603a56f8fbcc.tar.xz
drakx-22df0a00848e1b1d6fbd94dd85fa603a56f8fbcc.zip
dot not try to alter squid config in --testing mode
Diffstat (limited to 'perl-install/network/netconnect.pm')
-rw-r--r--perl-install/network/netconnect.pm175
1 files changed, 74 insertions, 101 deletions
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index 765466065..d25a79c0f 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -77,7 +77,7 @@ sub detect_timezone() {
my $first_time = $o_first_time || 0;
my ($network_configured, $direct_net_install, $cnx_type, $type, $interface, @cards, @all_cards, @devices);
my (%connection_steps, %connections, %rconnections, @connection_list);
- my ($ntf_name, $ipadr, $netadr, $gateway_ex, $up, $modem, $isdn, $isdn_type, $adsl_type, $need_restart_network);
+ my ($modem, $ntf_name, $ipadr, $netadr, $gateway_ex, $up, $modem, $isdn, $isdn_type, $adsl_type, $need_restart_network);
my ($module, $text, $auto_ip, $net_device, $onboot, $needhostname, $hotplug, $track_network_id, @fields); # lan config
my $success = 1;
my $ethntf = {};
@@ -108,6 +108,8 @@ sub detect_timezone() {
$netc->{autodetection} = 0;
$netc->{autodetect} = {};
+ my $first_modem = sub { first(grep { $_->{device} =~ m!^/dev! } values %{$netc->{autodetect}{modem}}) };
+
my $next_cnx_step = sub {
my $next = $connection_steps{$cnx_type};
# FIXME: we want this in standalone mode too:
@@ -118,16 +120,6 @@ sub detect_timezone() {
return $next;
};
- my $ppp_first_step = sub {
- $mouse ||= {};
- $mouse->{device} ||= readlink "$::prefix/dev/mouse";
- write_cnx_script($netc, "modem", join("\n", if_($::testing, "/sbin/route del default"), "ifup ppp0"),
- q(ifdown ppp0
-killall pppd
-), $netcnx->{type});
- my $need_to_ask = $modem->{device} || !$netc->{autodetect}{winmodem};
- return $need_to_ask ? "choose_serial_port" : "ppp_choose";
- };
my $handle_multiple_cnx = sub {
my $nb = keys %{$netc->{internet_cnx}};
@@ -180,7 +172,8 @@ If you don't want to use the auto detection, deselect the checkbox.
my @connections =
(
[ #-PO: here, "(detected)" string will be appended to eg "ADSL connection"
- N("Modem connection"), N("(detected on port %s)", $netc->{autodetect}{modem}), "modem" ],
+ N("Modem connection"), N("(detected on port %s)", join('', map { if_($_->{device}, $_->{device}) }
+ values %{$netc->{autodetect}{modem}})), "modem" ],
[ N("ISDN connection"), N("(detected %s)", join(', ', map { $_->{description} } values %{$netc->{autodetect}{isdn}})), "isdn" ],
[ N("ADSL connection"), N("(detected)"), "adsl" ],
[ N("Cable connection"), N("(detected)"), "cable" ],
@@ -350,12 +343,11 @@ If you don't want to use the auto detection, deselect the checkbox.
} else {
detect($netc->{autodetect}, 'modem') if !$::isInstall && !$netc->{autodetection};
$netc->{isdntype} = 'isdn_external';
- $netcnx->{isdn_external}{device} = $netc->{autodetect}{modem};
+ $netcnx->{isdn_external}{device} = $first_modem->();
$netcnx->{isdn_external} = isdn_read_config($netcnx->{isdn_external});
$netcnx->{isdn_external}{special_command} = 'AT&F&O2B40';
require network::modem;
$modem = $netcnx->{isdn_external};
- return &$ppp_first_step->();
};
},
@@ -389,47 +381,6 @@ If you don't want to use the auto detection, deselect the checkbox.
}
},
- winmodem =>
- {
- pre => sub {
- my ($in, $netcnx, $mouse, $netc) = @_;
- my %relocations = (ltmodem => $in->do_pkgs->check_kernel_module_packages('ltmodem'));
- my $type;
-
- detect($netc->{autodetect}, 'lan') if !$::isInstall && !$netc->{autodetection};
- $netc->{autodetect}{winmodem} or ($in->ask_warn(N("Warning"), N("You don't have any winmodem")) ? return 1 : $in->exit(0));
-
- foreach (keys %{$netc->{autodetect}{winmodem}}) {
- /Hcf/ and $type = "hcfpcimodem";
- /Hsf/ and $type = "hsflinmodem";
- /LT/ and $type = "ltmodem";
- $relocations{$type} || $type && $in->do_pkgs->what_provides($type) or $type = undef;
- }
-
- $type or ($in->ask_warn(N("Warning"), N("Your modem isn't supported by the system.
-Take a look at http://www.linmodems.org")) ? return 1 : $in->exit(0));
- my $e = $in->ask_from_list(N("Title"), N("\"%s\" based winmodem detected, do you want to install needed software ?", $type), [N("Install rpm"), N("Do nothing")]) or return 0;
- if ($e =~ /rpm/) {
- if ($in->do_pkgs->install($relocations{$type} ? @{$relocations{$type}} : $type)) {
- unless ($::isInstall) {
- #- fallback to modem configuration (beware to never allow test it).
- $netcnx->{type} = 'modem';
- #$type eq 'ltmodem' and $netc->{autodetect}{modem} = '/dev/ttyS14';
- return configure($in, $netcnx, $mouse, $netc);
- }
- } else {
- return 0;
- }
- }
- return 1;
- },
- },
-
- no_winmodem =>
- {
- name => N("Warning") . "\n\n" . N("You don't have any winmodem"),
- },
-
no_supported_winmodem =>
{
name => N("Warning") . "\n\n" . N("Your modem isn't supported by the system.
@@ -445,42 +396,53 @@ Take a look at http://www.linmodems.org"),
pre => sub {
detect($netc->{autodetect}, 'modem') if !$::isInstall;
$netcnx->{type} = 'modem';
- my $modem = $netcnx->{$netcnx->{type}};
- $modem->{device} = $netc->{autodetect}{modem};
- my %l = getVarsFromSh("$::prefix/usr/share/config/kppprc");
- $modem->{connection} = $l{Name};
- $modem->{domain} = $l{Domain};
- ($modem->{dns1}, $modem->{dns2}) = split(',', $l{DNS});
-
- foreach (cat_("/etc/sysconfig/network-scripts/chat-ppp0")) {
- /.*ATDT(\d*)/ and $modem->{phone} = $1;
- }
- foreach (cat_("/etc/sysconfig/network-scripts/ifcfg-ppp0")) {
- /NAME=(['"]?)(.*)\1/ and $modem->{login} = $2;
- }
- my $secret = network::tools::read_secret_backend();
- foreach (@$secret) {
- $modem->{passwd} = $_->{passwd} if $_->{login} eq $modem->{login};
- }
},
name => N("Select the modem to configure:"),
data => sub {
- [ { label => N("Modem"), type => "list", val => \$ntf_name, list => [ grep { $_ } $netc->{autodetect}{modem}, values %{$netc->{autodetect}{winmodem}} ], allow_empty_list => 1 } ],
+ [ { label => N("Modem"), type => "list", val => \$modem, list => [ keys %{$netc->{autodetect}{modem}} ], allow_empty_list => 1 } ],
+ },
+ post => sub {
+ $mouse ||= {};
+ $mouse->{device} ||= readlink "$::prefix/dev/mouse";
+ write_cnx_script($netc, "modem", join("\n", if_($::testing, "/sbin/route del default"), "ifup ppp0"), q(
+ifdown ppp0
+killall pppd
+), $netcnx->{type});
+ $ntf_name = $netc->{autodetect}{modem}{$modem}{device} || $netc->{autodetect}{modem}{$modem}{description};
+ print "Interface is $ntf_name\n";
+
+ return "ppp_choose" if $ntf_name =~ m!^/dev/!;
+ return "choose_serial_port" if !$ntf_name;
+
+ my %relocations = (ltmodem => $in->do_pkgs->check_kernel_module_packages('ltmodem'));
+ my $type;
+
+ detect($netc->{autodetect}, 'lan') if !$::isInstall && !$netc->{autodetection};
+
+ foreach (map { $_->{description} } values %{$netc->{autodetect}{modem}}) {
+ /Hcf/ and $type = "hcfpcimodem";
+ /Hsf/ and $type = "hsflinmodem";
+ /LT/ and $type = "ltmodem";
+ $relocations{$type} || $type && $in->do_pkgs->what_provides($type) or $type = undef;
+ }
+
+ return "no_supported_winmodem" if !$type;
+
+ $in->do_pkgs->install($relocations{$type} ? @{$relocations{$type}} : $type);
+
+ #$type eq 'ltmodem' and $netc->{autodetect}{modem} = '/dev/ttyS14';
+
+ #- fallback to modem configuration (beware to never allow test it).
+ return "ppp_choose";
},
- post => $ppp_first_step,
},
- # FIXME: only if $need_to_ask
+
choose_serial_port =>
{
pre => sub {
$mouse ||= {};
$mouse->{device} ||= readlink "$::prefix/dev/mouse";
- write_cnx_script($netc, "modem", join("\n", if_($::testing, "/sbin/route del default"), "ifup ppp0"),
- q(ifdown ppp0
-killall pppd
-), $netcnx->{type});
- my $need_to_ask = $modem->{device} || !$netc->{autodetect}{winmodem};
},
name => N("Please choose which serial port your modem is connected to."),
@@ -494,6 +456,28 @@ killall pppd
ppp_choose =>
{
pre => sub {
+ write_cnx_script($netc, "modem", join("\n", if_($::testing, "/sbin/route del default"), "ifup ppp0"),
+ q(ifdown ppp0
+killall pppd
+), $netcnx->{type});
+ $modem = $netcnx->{$netcnx->{type}};
+ $modem->{device} = $first_modem->();
+ my %l = getVarsFromSh("$::prefix/usr/share/config/kppprc");
+ $modem->{connection} = $l{Name};
+ $modem->{domain} = $l{Domain};
+ ($modem->{dns1}, $modem->{dns2}) = split(',', $l{DNS});
+
+ foreach (cat_("/etc/sysconfig/network-scripts/chat-ppp0")) {
+ /.*ATDT(\d*)/ and $modem->{phone} = $1;
+ }
+ foreach (cat_("/etc/sysconfig/network-scripts/ifcfg-ppp0")) {
+ /NAME=(['"]?)(.*)\1/ and $modem->{login} = $2;
+ }
+ my $secret = network::tools::read_secret_backend();
+ foreach (@$secret) {
+ $modem->{passwd} = $_->{passwd} if $_->{login} eq $modem->{login};
+ }
+
#my $secret = network::tools::read_secret_backend();
#my @cnx_list = map { $_->{server} } @$secret;
},
@@ -740,21 +724,23 @@ I cannot set up this connection type.")), return;
static_hostname =>
{
pre => sub {
-
$netc->{dnsServer} ||= dns($intf->{IPADDR});
$gateway_ex = gateway($intf->{IPADDR});
#- $netc->{GATEWAY} ||= gateway($intf->{IPADDR});
},
+ name => N("Enter a Zeroconf host name which will be the one that your machine will get back to other machines on the network:"),
name => N("Please enter your host name.
Your host name should be a fully-qualified host name,
such as ``mybox.mylab.myco.com''.
You may also enter the IP address of the gateway if you have one."),
data => sub {
[ if_(!$auto_ip, { label => N("Host name"), val => \$netc->{HOSTNAME} }),
+ if_(!network::tools::is_dynamic_host($intf),
+ { label => N("Zeroconf Host name"), val => \$netc->{ZEROCONF_HOSTNAME} }),
{ label => N("DNS server 1"), val => \$netc->{dnsServer} },
- { label => N("DNS server 2"), val => \$netc->{dnsServer2} },
- { label => N("DNS server 3"), val => \$netc->{dnsServer3} },
- { label => N("Search domain"), val => \$netc->{DOMAINNAME},
+ { label => N("DNS server 2"), val => \$netc->{dnsServer2}, advanced => 1 },
+ { label => N("DNS server 3"), val => \$netc->{dnsServer3}, advanced => 1 },
+ { label => N("Search domain"), val => \$netc->{DOMAINNAME}, advanced => 1,
help => N("By default search domain will be set from the fully-qualified host name") },
if_(!$auto_ip, { label => N("Gateway (e.g. %s)", $gateway_ex), val => \$netc->{GATEWAY} },
if_(@devices > 1,
@@ -774,20 +760,6 @@ You may also enter the IP address of the gateway if you have one."),
$in->ask_warn(N("Error"), N("Gateway address should be in format 1.2.3.4"));
return 1;
}
- },
- #post => $handle_multiple_cnx,
- next => "zeroconf",
- },
-
- dhcp_hostname =>
- {
- },
-
- zeroconf =>
- {
- name => N("Enter a Zeroconf host name which will be the one that your machine will get back to other machines on the network:"),
- data => [ { label => N("Zeroconf Host name"), val => \$netc->{ZEROCONF_HOSTNAME} } ],
- complete => sub {
if ($netc->{ZEROCONF_HOSTNAME} =~ /\./) {
$in->ask_warn(N("Error"), N("Zeroconf host name must not contain a ."));
return 1;
@@ -796,6 +768,7 @@ You may also enter the IP address of the gateway if you have one."),
post => $handle_multiple_cnx,
},
+
multiple_internet_cnx =>
{
name => N("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"),
@@ -917,10 +890,10 @@ Click on Ok to keep your configuration, or cancel to reconfigure your Internet &
and do {
$netcnx->{type} = 'lan';
output_with_perm("$::prefix$connect_file", 0755, qq(ifup eth0
-));
- output("$::prefix$disconnect_file", 0755, qq(
+)) if $::testing;
+ output("$::prefix$disconnect_file", 0755, qq(
ifdown eth0
-));
+)) if $::testing;
$direct_net_install = 1;
$use_wizard = 0;
};