diff options
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/args.pm | 10 | ||||
-rw-r--r-- | urpm/cfg.pm | 2 | ||||
-rw-r--r-- | urpm/download.pm | 24 |
3 files changed, 31 insertions, 5 deletions
diff --git a/urpm/args.pm b/urpm/args.pm index b6aa04a6..a4ae78da 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -96,9 +96,11 @@ my %options_spec = ( 'parallel=s' => \$::parallel, wget => sub { $urpm->{options}{downloader} = 'wget' }, curl => sub { $urpm->{options}{downloader} = 'curl' }, + prozilla => sub { $urpm->{options}{downloader} = 'prozilla' }, 'curl-options=s' => sub { $urpm->{options}{'curl-options'} = $_[1] }, 'rsync-options=s' => sub { $urpm->{options}{'rsync-options'} = $_[1] }, 'wget-options=s' => sub { $urpm->{options}{'wget-options'} = $_[1] }, + 'prozilla-options=s' => sub { $urpm->{options}{'prozilla-options'} = $_[1] }, 'limit-rate=s' => sub { $urpm->{options}{'limit-rate'} = $_[1] }, 'resume!' => sub { $urpm->{options}{resume} = $_[1] }, 'retry=s' => sub { $urpm->{options}{retry} = $_[1] }, @@ -389,16 +391,16 @@ foreach my $k ("help|h", "version", "no-locales", "update", "media|mediums=s", $options_spec{urpmf}{$k} = $options_spec{urpmi}{$k}; } -foreach my $k ("help|h", "version", "wget", "curl", "proxy=s", "proxy-user=s", - "wget-options=s", "curl-options=s", "rsync-options=s") +foreach my $k ("help|h", "version", "wget", "curl", "prozilla", "proxy=s", "proxy-user=s", + "wget-options=s", "curl-options=s", "rsync-options=s", "prozilla-options=s") { $options_spec{'urpmi.update'}{$k} = $options_spec{urpmq}{$k} = $options_spec{urpmi}{$k}; } -foreach my $k ("help|h", "wget", "curl", "proxy=s", "proxy-user=s", "c", "f", "z", +foreach my $k ("help|h", "wget", "curl", "prozilla", "proxy=s", "proxy-user=s", "c", "f", "z", "limit-rate=s", "no-md5sum", "update", "norebuild!", - "wget-options=s", "curl-options=s", "rsync-options=s") + "wget-options=s", "curl-options=s", "rsync-options=s", "prozilla-options=s") { $options_spec{'urpmi.addmedia'}{$k} = $options_spec{'urpmi.update'}{$k}; } diff --git a/urpm/cfg.pm b/urpm/cfg.pm index 1493abb5..f39679e1 100644 --- a/urpm/cfg.pm +++ b/urpm/cfg.pm @@ -157,7 +157,7 @@ sub load_config ($;$) { |downloader |retry |default-media - |(?:curl|rsync|wget)-options + |(?:curl|rsync|wget|prozilla)-options )\s*:\s*['"]?(.*?)['"]?$/x and $config{$medium}{$1} = $2, next; /^key[-_]ids\s*:\s*['"]?(.*?)['"]?$/ diff --git a/urpm/download.pm b/urpm/download.pm index 57bd191b..0363f683 100644 --- a/urpm/download.pm +++ b/urpm/download.pm @@ -512,6 +512,30 @@ sub sync_ssh { sync_rsync($options, @_); } +sub sync_prozilla { + -x "/usr/bin/proz" or die N("prozilla is missing\n"); + my $options = shift; + $options = { dir => $options } if !ref $options; + #- force download to be done in cachedir to avoid polluting cwd. + (my $cwd) = getcwd() =~ /(.*)/; + chdir $options->{dir}; + my $proz_command = join(" ", map { "'$_'" } + "/usr/bin/proz", + "--no-curses", + (defined $options->{'prozilla-options'} ? split /\s+/, $options->{'prozilla-options'} : ()), + @_ + ); + my $ret = system($proz_command); + chdir $cwd; + if ($ret) { + if ($? == -1) { + die N("Couldn't execute prozilla\n"); + } else { + die N("prozilla failed: exited with %d or signal %d\n", $? >> 8, $? & 127); + } + } +} + sub start_ssh_master { my ($server, $user) = @_; $server or return 0; |