summaryrefslogtreecommitdiffstats
path: root/perl-install/install_any.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-09-09 09:52:40 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-09-09 09:52:40 +0000
commitab7170507346c8ebb28e4b4bfe9a0713dd0e591c (patch)
tree6d48c68af2b34b8c8915830cc407b50038a03537 /perl-install/install_any.pm
parent49790b1e7e8fed6b7735c3f57813c932ea5e3317 (diff)
downloaddrakx-ab7170507346c8ebb28e4b4bfe9a0713dd0e591c.tar
drakx-ab7170507346c8ebb28e4b4bfe9a0713dd0e591c.tar.gz
drakx-ab7170507346c8ebb28e4b4bfe9a0713dd0e591c.tar.bz2
drakx-ab7170507346c8ebb28e4b4bfe9a0713dd0e591c.tar.xz
drakx-ab7170507346c8ebb28e4b4bfe9a0713dd0e591c.zip
Re-read all hdlists in reverse order when there are supplementary media.
Don't unselect every single media when doing an installation from iso images.
Diffstat (limited to 'perl-install/install_any.pm')
-rw-r--r--perl-install/install_any.pm84
1 files changed, 64 insertions, 20 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 4d37e6c1f..4ad8321b8 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -363,6 +363,7 @@ sub preConfigureTimezone {
}
sub deselectFoundMedia {
+ #- TODO group by CD
my ($o, $hdlists) = @_;
my $l = $o->ask_many_from_list('',
N("The following installation media have been found.
@@ -396,6 +397,27 @@ Do you have a supplementary installation media to configure?",
return $suppl;
}
+#- if the supplementary media is networked, but not the main one, network
+#- support must be installed and network started.
+sub prep_net_suppl_media {
+ return if our $net_suppl_media_configured;
+ $net_suppl_media_configured = 1;
+ my ($o) = @_;
+ #- install basesystem now
+ $::o->do_pkgs->ensure_is_installed('basesystem', undef, 1);
+ #- from install_steps_interactive:
+ local $::expert = $::expert;
+ require network::netconnect;
+ network::netconnect::main($o->{prefix}, $o->{netcnx} ||= {}, $o, $o->{modules_conf}, $o->{netc}, $o->{mouse}, $o->{intf}, 0, 1);
+ require install_interactive;
+ install_interactive::upNetwork($o);
+ #- force reinitialisation of network modules
+ delete $INC{'IO/Socket.pm'};
+ delete $INC{'IO/Socket/UNIX.pm'};
+ delete $INC{'IO/Socket/INET.pm'};
+ require IO::Socket;
+}
+
sub selectSupplMedia {
my ($o, $suppl_method) = @_;
#- ask whether there are supplementary media
@@ -411,24 +433,9 @@ sub selectSupplMedia {
my $medium_name = $suppl_method eq 'cdrom'
? (max(map { $_->{medium} =~ /^(\d+)s$/ ? $1 : 0 } values %{$o->{packages}{mediums}}) + 1) . "s"
: int(keys %{$o->{packages}{mediums}}) + 1;
- local $::isWizard = 0;
#- configure network if needed
- if (!(our $asked) && !scalar keys %{$o->{intf}} && $suppl_method !~ /^(?:cdrom|disk)/) {
- $asked = 1;
- #- install basesystem now
- $::o->do_pkgs->ensure_is_installed('basesystem', undef, 1);
- #- from install_steps_interactive:
- local $::expert = $::expert;
- require network::netconnect;
- network::netconnect::main($o->{prefix}, $o->{netcnx} ||= {}, $o, $o->{modules_conf}, $o->{netc}, $o->{mouse}, $o->{intf}, 0, 1);
- require install_interactive;
- install_interactive::upNetwork($o);
- #- force reinitialisation of network modules
- delete $INC{'IO/Socket.pm'};
- delete $INC{'IO/Socket/UNIX.pm'};
- delete $INC{'IO/Socket/INET.pm'};
- require IO::Socket;
- }
+ prep_net_suppl_media($o) if !scalar keys %{$o->{intf}} && $suppl_method !~ /^(?:cdrom|disk)/;
+ local $::isWizard = 0;
my $main_method = $o->{method};
local $o->{method} = $suppl_method;
if ($suppl_method eq 'cdrom') {
@@ -535,15 +542,51 @@ sub setup_suppl_medium {
$supplmedium->{with_hdlist} = 'media_info/hdlist.cz'; #- for install_urpmi
}
+sub _media_rank {
+ my ($x) = @_;
+ my ($y, $s) = $x =~ /(\d+)(s?)\)\.cz/;
+ $s and $y += 100;
+ $y;
+}
+
sub setPackages {
my ($o, $rebuild_needed) = @_;
require pkgs;
if (!$o->{packages} || is_empty_array_ref($o->{packages}{depslist})) {
($o->{packages}, my $suppl_method) = pkgs::psUsingHdlists($o, $o->{method});
-
- 1 while
- $suppl_method = $o->selectSupplMedia($suppl_method);
+ my $nb_suppl_media = 0;
+
+ ++$nb_suppl_media while $suppl_method = $o->selectSupplMedia($suppl_method);
+
+ if ($nb_suppl_media) {
+ #- reread all hdlists and recompute dependencies
+ log::l("re-read hdlists");
+ pkgs::cleanHeaders($o->{prefix});
+ %pkgs::uniq_pkg_seen = ();
+ my $oldmediums = $o->{packages}{mediums};
+ delete $o->{packages}{rpmdb}; delete $o->{packages};
+ $o->{packages} = new URPM;
+ @{$o->{packages}}{qw(count mediums)} = (0, {}); #- add additional fields used by DrakX
+ for my $h (sort { _media_rank($b) <=> _media_rank($a) } glob(pkgs::urpmidir($o->{prefix}) . "/hdlist.*.cz")) {
+ my ($description, $method, $medium_name) = $h =~ /hdlist\.(.*) \(([-a-z]*)(\d+s?)\)\.cz/;
+ my $m = pkgs::psUsingHdlist(
+ $o->{prefix},
+ $method,
+ $o->{packages},
+ $oldmediums->{$medium_name}{hdlist},
+ $medium_name,
+ $oldmediums->{$medium_name}{rpmsdir},
+ $description,
+ 1, #- selected
+ $h, #- fhdlist
+ undef, #- pubkey
+ 1, #- nocopy
+ );
+ defined $oldmediums->{$medium_name}{$_} and $m->{$_} = $oldmediums->{$medium_name}{$_} for qw(hdlist_size synthesis_hdlist_size with_hdlist ftp_prefix pubkey);
+ }
+ #$o->{packages}->compute_deps;
+ }
#- open rpm db according to right mode needed.
$o->{packages}{rpmdb} ||= pkgs::rpmDbOpen($o->{prefix}, $rebuild_needed);
@@ -767,6 +810,7 @@ sub install_urpmi {
#- rare case where urpmi cannot be installed (no hd install path).
$method eq 'disk' && !any::hdInstallPath() and return;
+ log::l("install_urpmi $method");
#- clean to avoid opening twice the rpm db.
delete $packages->{rpmdb};