summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2022-11-20 09:42:55 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2022-11-20 09:42:55 +0000
commit157fe5bf31626e49ece9613faf100fdc924318f8 (patch)
tree8c29bbb7134dadf65600862d917bc23d79588ab1 /perl-install
parent7c7df97790003ac5b47658a5ac94054fbd24e7e1 (diff)
downloaddrakx-157fe5bf31626e49ece9613faf100fdc924318f8.tar
drakx-157fe5bf31626e49ece9613faf100fdc924318f8.tar.gz
drakx-157fe5bf31626e49ece9613faf100fdc924318f8.tar.bz2
drakx-157fe5bf31626e49ece9613faf100fdc924318f8.tar.xz
drakx-157fe5bf31626e49ece9613faf100fdc924318f8.zip
Add subroutine to set urpmi downloader.
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/any.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 933976302..011fb4f73 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -1197,6 +1197,22 @@ sub urpmi_add_all_media {
$val;
}
+sub urpmi_set_downloader {
+ my ($in, $urpm, $downloader) = @_;
+
+ if ($urpm->{global_config}{downloader} ne $downloader) {
+ my $binary = $downloader eq 'aria2' ? 'aria2c' : $downloader;
+ if ($in->do_pkgs->ensure_binary_is_installed($downloader, $binary, 1)) {
+ log::l("Setting urpmi downloader to '$downloader'");
+ $urpm->{global_config}{downloader} = $downloader;
+ urpm::media::write_config($urpm);
+ } else {
+ return;
+ }
+ }
+ 1;
+}
+
sub format_wm {
my ($wm) = @_;
return {