From 63b06831d3c1ee0eb8d6cb5f53a5682b512fb5dd Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 13 Oct 2009 17:00:12 +0000 Subject: check the FS has enough space before trying to download all packages --- urpm/main_loop.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'urpm/main_loop.pm') diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm index c34a8e40..f6a5330f 100644 --- a/urpm/main_loop.pm +++ b/urpm/main_loop.pm @@ -98,12 +98,21 @@ sub download_packages { } if ($urpm->{options}{'download-all'}) { - print "Downloading everything!\n"; + my (undef, $available) = urpm::sys::df("$urpm->{cachedir}/rpms"); + + if (!$urpm->{options}{ignoresize}) { + my ($download_size) = urpm::get_pkgs::get_distant_media_filesize ($urpm, $blists, \%sources); + if ($download_size >= $available*1000) { + my $noexpr = N("Nn"); + my $p = N("There is not enough space on your filesystem to download all packages (%s needed, %s available).\nAre you sure you want to continue?", formatXiB($download_size), formatXiB($available*1000)); + $force || urpm::msg::ask_yes_or_no($p) or exit 0; + } + } + my (@error_sources) = download_packages($blists, \%sources); if (@error_sources) { return 10; } - print "Everything downloaded\n"; } #- now create transaction just before installation, this will save user impression of slowness. -- cgit v1.2.1