summaryrefslogtreecommitdiffstats
path: root/perl-install/install
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2009-04-06 15:57:17 +0000
committerThierry Vignaud <tv@mandriva.org>2009-04-06 15:57:17 +0000
commitf9791099ddb57fb34249cee546051fe8e4c21f6b (patch)
treeb253470c45de3576121b65b71c8554d1f4ac16eb /perl-install/install
parentc2a5241679a93f99959cbe85b06dc2b31868ef11 (diff)
downloaddrakx-backup-do-not-use-f9791099ddb57fb34249cee546051fe8e4c21f6b.tar
drakx-backup-do-not-use-f9791099ddb57fb34249cee546051fe8e4c21f6b.tar.gz
drakx-backup-do-not-use-f9791099ddb57fb34249cee546051fe8e4c21f6b.tar.bz2
drakx-backup-do-not-use-f9791099ddb57fb34249cee546051fe8e4c21f6b.tar.xz
drakx-backup-do-not-use-f9791099ddb57fb34249cee546051fe8e4c21f6b.zip
(_get_media_url) extract it from get_media_cfg()
Diffstat (limited to 'perl-install/install')
-rw-r--r--perl-install/install/media.pm30
1 files changed, 18 insertions, 12 deletions
diff --git a/perl-install/install/media.pm b/perl-install/install/media.pm
index e6f64896a..f85bfbeea 100644
--- a/perl-install/install/media.pm
+++ b/perl-install/install/media.pm
@@ -621,6 +621,23 @@ sub _url2phys_medium {
}
}
+sub _get_media_url {
+ my ($o, $phys_medium) = @_;
+ my $uri;
+ if ($phys_medium->{is_suppl}) {
+ if (member($phys_medium->{method}, qw(ftp http))) {
+ $uri = $phys_medium->{url};
+ $uri =~ s!/media$!!;
+ } elsif ($phys_medium->{method} eq 'nfs') {
+ $uri = "$::prefix/$phys_medium->{mntpoint}";
+ }
+ } else {
+ $uri = $o->{stage2_phys_medium}{url} =~ m!^(http|ftp)://! && $o->{stage2_phys_medium}{url} ||
+ $phys_medium->{method} =~ m!^(ftp|http)://! && $phys_medium->{method} || '/tmp/image';
+ }
+ $uri;
+ }
+
sub get_media_cfg {
my ($o, $phys_medium, $packages, $selected_names, $force_rpmsrate) = @_;
@@ -636,18 +653,7 @@ sub get_media_cfg {
log::l(Data::Dumper->Dump([ $phys_medium ], [ 'phys_medium' ]));
log::l(Data::Dumper->Dump([ $o->{stage2_phys_medium} ], [ 'stage2_phys_medium' ]));
- my $uri;
- if ($phys_medium->{is_suppl}) {
- if (member($phys_medium->{method}, qw(ftp http))) {
- $uri = $phys_medium->{url};
- $uri =~ s!/media$!!;
- } elsif ($phys_medium->{method} eq 'nfs') {
- $uri = "$::prefix/$phys_medium->{mntpoint}";
- }
- } else {
- $uri = $o->{stage2_phys_medium}{url} =~ m!^(http|ftp)://! && $o->{stage2_phys_medium}{url} ||
- $phys_medium->{method} =~ m!^(ftp|http)://! && $phys_medium->{method} || '/tmp/image';
- }
+ my $uri = _get_media_url($o, $phys_medium);
log::l("adding distrib media from $uri");
urpm::media::add_distrib_media($packages, undef, $uri, ask_media => undef); #allmedia => 1