summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pod/urpmi.8.pod5
-rw-r--r--urpm.pm21
-rw-r--r--urpm/args.pm3
-rw-r--r--urpm/main_loop.pm7
4 files changed, 23 insertions, 13 deletions
diff --git a/pod/urpmi.8.pod b/pod/urpmi.8.pod
index 287c462e..d4ae0c60 100644
--- a/pod/urpmi.8.pod
+++ b/pod/urpmi.8.pod
@@ -257,12 +257,13 @@ Configure urpmi on the fly from a distrib tree, useful to install a chroot
with the B<--root> option. See the description of the B<--distrib> option
in the C<urpmi.addmedia> manpage.
-=item B<--download-all>
+=item B<--download-all> I<dest-dir>
By default, urpmi will download packages when they are needed. This can be
problematic when connection failures happen during a big upgrade. When this
option is set, urpmi will first download all the needed packages and proceed
-to install them if it managed to download them all.
+to install them if it managed to download them all. You can optionally
+specify a directory where the files should be downloaded (default is /var/cache/urpmi which could be too small to hold all the files).
=item B<--downloader> I<program name>
diff --git a/urpm.pm b/urpm.pm
index ee0fb519..44b1ed16 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -99,15 +99,9 @@ sub prefer_rooted {
-e "$root$file" ? "$root$file" : $file;
}
-sub userdir_prefix {
- my ($_urpm) = @_;
- '/tmp/.urpmi-';
-}
-sub userdir {
- my ($urpm) = @_;
- $< or return;
+sub init_cache_dir {
+ my ($urpm, $dir) = @_;
- my $dir = ($urpm->{urpmi_root} || '') . userdir_prefix($urpm) . $<;
mkdir $dir, 0755; # try to create it
-d $dir && ! -l $dir or $urpm->{fatal}(1, N("fail to create directory %s", $dir));
@@ -118,6 +112,17 @@ sub userdir {
$dir;
}
+sub userdir_prefix {
+ my ($_urpm) = @_;
+ '/tmp/.urpmi-';
+}
+sub userdir {
+ my ($urpm) = @_;
+ $< or return;
+
+ my $dir = ($urpm->{urpmi_root} || '') . userdir_prefix($urpm) . $<;
+ init_cache_dir($$urpm, $dir);
+}
sub ensure_valid_cachedir {
my ($urpm) = @_;
if (my $dir = userdir($urpm)) {
diff --git a/urpm/args.pm b/urpm/args.pm
index d9e26718..e2a0751f 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -130,8 +130,7 @@ my %options_spec = (
'parallel=s' => \$::parallel,
'metalink!' => sub { $urpm->{options}{metalink} = $_[1] },
- 'download-all!' => sub { $urpm->{options}{'download-all'} = $_[1] },
-
+ 'download-all:s' => sub { $urpm->{options}{'download-all'} = $_[1] },
# deprecated in favor of --downloader xxx
wget => sub { $urpm->{options}{downloader} = 'wget' },
curl => sub { $urpm->{options}{downloader} = 'curl' },
diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm
index fdcff529..6c39759c 100644
--- a/urpm/main_loop.pm
+++ b/urpm/main_loop.pm
@@ -94,10 +94,15 @@ sub download_packages {
join("\n", map { " $_->[0]" } @bad));
}
}
+
(\@error_sources, \@msgs);
}
-if ($urpm->{options}{'download-all'}) {
+if (exists $urpm->{options}{'download-all'}) {
+ if ($urpm->{options}{'download-all'}) {
+ $urpm->{cachedir} = $urpm->{'urpmi-root'}.$urpm->{options}{'download-all'};
+ urpm::init_cache_dir($urpm, $urpm->{cachedir});
+ }
my (undef, $available) = urpm::sys::df("$urpm->{cachedir}/rpms");
if (!$urpm->{options}{ignoresize}) {