From da188129369fdbff0dfb3d280255dfba91d736b4 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Fri, 16 Sep 2005 16:10:32 +0000 Subject: automatically configure DSL connection on installation from DSL --- perl-install/install2.pm | 18 ++++++++++++++++-- perl-install/install_any.pm | 6 ++++++ perl-install/install_steps_interactive.pm | 10 ++++++++-- perl-install/network/adsl.pm | 11 ++++++----- 4 files changed, 36 insertions(+), 9 deletions(-) (limited to 'perl-install') diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 220114975..a7a29d35a 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -468,8 +468,22 @@ sub main { log::l("found network config file $file"); add2hash($o->{net}{resolv} ||= {}, network::network::read_resolv_conf($file)); } - $o->{net}{type} = 'lan'; - $o->{net}{net_interface} = first(values %{$o->{net}{ifcfg}}); + my $dsl_device = find { $_->{BOOTPROTO} eq 'adsl_pppoe' } values %{$o->{net}{ifcfg}}; + if ($dsl_device) { + $o->{net}{type} = 'adsl'; + $o->{net}{net_interface} = $dsl_device->{DEVICE}; + $o->{net}{adsl} = { + method => 'pppoe', + device => 'pppoe_modem', + ethernet_device => $dsl_device->{DEVICE}, + login => $dsl_device->{USER}, + password => $dsl_device->{PASS}, + }; + %$dsl_device = (); + } else { + $o->{net}{type} = 'lan'; + $o->{net}{net_interface} = first(values %{$o->{net}{ifcfg}}); + } } #- done after module dependencies are loaded for "vfat depends on fat" diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 890e6b4c3..636825edd 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -290,6 +290,12 @@ sub dont_run_directly_stage2() { readlink("/usr/bin/runinstall2") eq "runinstall2.sh"; } +#- FIXME: use it whenever possible once unfrozen +sub is_network_install { + my ($o) = @_; + member($o->{method}, qw(ftp http nfs)); +} + sub start_i810fb() { my ($vga) = cat_('/proc/cmdline') =~ /vga=(\S+)/; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 0b56615ea..fffc4b81d 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -789,8 +789,14 @@ sub configureNetwork { require network::netconnect; network::netconnect::real_main($o->{net}, $o, $o->{modules_conf}); } else { - require network::network; - network::network::easy_dhcp($o->{net}, $o->{modules_conf}); + #- don't overwrite configuration in a network install + if (!install_any::is_network_install($o)) { + require network::network; + network::network::easy_dhcp($o->{net}, $o->{modules_conf}); + } elsif ($o->{net}{type} eq 'adsl') { + require network::adsl; + network::adsl::adsl_conf_backend($o, $o->{modules_conf}, $o->{net}); + } $o->SUPER::configureNetwork; } } diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm index f2722f262..f3b113682 100644 --- a/perl-install/network/adsl.pm +++ b/perl-install/network/adsl.pm @@ -280,11 +280,12 @@ user "$net->{adsl}{login}" #- FIXME: ppp0 and ippp0 are hardcoded my $metric = network::tools::get_default_metric("adsl"); #- FIXME, do not override if already set - put_in_hash($net->{ifcfg}{ppp0}, { - DEVICE => 'ppp0', - TYPE => 'ADSL', - METRIC => $metric, - }) unless member($adsl_type, qw(static dhcp)); + put_in_hash($net->{ifcfg}{ppp0} ||= {}, { + DEVICE => 'ppp0', + TYPE => 'ADSL', + METRIC => $metric, + ONBOOT => 'yes', #- will be modified later in netconnect if requested + }) unless member($adsl_type, qw(static dhcp)); #- remove file used with sagem for dhcp/static connections unlink("$::prefix/etc/sysconfig/network-scripts/ifcfg-sagem"); -- cgit v1.2.1