diff options
author | Francois Pons <fpons@mandriva.com> | 2002-03-06 17:39:50 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-03-06 17:39:50 +0000 |
commit | 687cc6657f25d1521869be42bd928feeb82d3791 (patch) | |
tree | 2fcc7ef7a6601b9374e2a787be58f6425df1607c /perl-install | |
parent | 3dccf7ea4f78e8ab22e2f7ba542b60ff8d320176 (diff) | |
download | drakx-687cc6657f25d1521869be42bd928feeb82d3791.tar drakx-687cc6657f25d1521869be42bd928feeb82d3791.tar.gz drakx-687cc6657f25d1521869be42bd928feeb82d3791.tar.bz2 drakx-687cc6657f25d1521869be42bd928feeb82d3791.tar.xz drakx-687cc6657f25d1521869be42bd928feeb82d3791.zip |
fixed error when using multiple removable media and user aborted installation
(for some other error) and hdlists cannot be retrieved.
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/pkgs.pm | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index b79369ab6..4a63046ed 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -353,7 +353,21 @@ sub unselectAllPackagesIncludingUpgradable($) { } sub psUpdateHdlistsDeps { - my ($prefix, $method) = @_; + my ($prefix, $method, $packages) = @_; + my ($good_hdlists_deps, $mediums) = (0, 0); + + #- check if current configuration is still up-to-date and do not need to be updated. + foreach (values %{$packages->{mediums}}) { + my $hdlistf = "$prefix/var/lib/urpmi/hdlist.$_->{fakemedium}.cz" . ($_->{hdlist} =~ /\.cz2/ && "2"); + my $synthesisf = "$prefix/var/lib/urpmi/synthesis.hdlist.$_->{fakemedium}.cz" . ($_->{hdlist} =~ /\.cz2/ && "2"); + -s $hdlistf == $_->{hdlist_size} && -s $synthesisf == $_->{synthesis_hdlist_size} and ++$good_hdlists_deps; + ++$mediums; + } + $good_hdlists_deps > 0 && $good_hdlists_deps == $mediums and return; #- nothing to do. + + #- at this point, this means partition has problably be reformatted and hdlists should be retrieved. + install_any::useMedium($install_any::boot_medium); + my $listf = install_any::getFile('Mandrake/base/hdlists') or die "no hdlists found"; #- WARNING: this function should be kept in sync with functions @@ -437,9 +451,13 @@ sub psUsingHdlist { my $newf = "$prefix/var/lib/urpmi/hdlist.$fakemedium.cz" . ($hdlist =~ /\.cz2/ && "2"); -e $newf and do { unlink $newf or die "cannot remove $newf: $!"; }; install_any::getAndSaveFile($fhdlist || "Mandrake/base/$hdlist", $newf) or die "no $hdlist found"; + $m->{hdlist_size} = -s $newf; #- keep track of size for post-check. symlinkf $newf, "/tmp/$hdlist"; - install_any::getAndSaveFile("Mandrake/base/synthesis.$hdlist", - "$prefix/var/lib/urpmi/synthesis.hdlist.$fakemedium.cz" . ($hdlist =~ /\.cz2/ && "2")); + + #- copy existing synthesis file too. + my $newsf = "$prefix/var/lib/urpmi/synthesis.hdlist.$fakemedium.cz" . ($hdlist =~ /\.cz2/ && "2"); + install_any::getAndSaveFile("Mandrake/base/synthesis.$hdlist", $newsf); + $m->{synthesis_hdlist_size} = -s $newsf; #- keep track of size for post-check. #- avoid using more than one medium if Cd is not ejectable. #- but keep all medium here so that urpmi has the whole set. |