diff options
Diffstat (limited to 'perl-install/install/media.pm')
| -rw-r--r-- | perl-install/install/media.pm | 50 |
1 files changed, 15 insertions, 35 deletions
diff --git a/perl-install/install/media.pm b/perl-install/install/media.pm index 27b931266..149deffc3 100644 --- a/perl-install/install/media.pm +++ b/perl-install/install/media.pm @@ -1,4 +1,4 @@ -package install::media; # $Id: media.pm 269998 2010-06-11 17:28:57Z blino $ +package install::media; use strict; @@ -6,6 +6,9 @@ our @ISA = qw(Exporter); our @EXPORT_OK = qw(getFile_ getAndSaveFile_ getAndSaveFile_media_info packageMedium); use common; +use Data::Dumper; +# Make sure report.bug are more easily comparable: +$Data::Dumper::Sortkeys = 1; use fs::type; use urpm::download; use urpm::media; @@ -42,11 +45,6 @@ use urpm::media; our $postinstall_rpms = ''; my %mounted_media; -sub _free_medium_id { - my ($media) = @_; - int(@$media); -} - sub allMediums { my ($packages) = @_; @@ -81,16 +79,6 @@ sub path { ($phys_m->{real_mntpoint} || fs::get::mntpoint_prefixed($phys_m)) . $phys_m->{rel_path} . '/' . $f; } -sub rel_rpm_file { - my ($medium, $f) = @_; - if (my ($arch) = $f =~ m|\.([^\.]*)\.rpm$|) { - $f = "$medium->{rpmsdir}/$f"; - $f =~ s/%{ARCH}/$arch/g; - $f =~ s,^/+,,g; - } - $f; -} - sub umount_phys_medium { my ($phys_m) = @_; @@ -172,7 +160,7 @@ sub stage2_phys_medium { my $user = $ENV{LOGIN} && ($ENV{LOGIN} . ($ENV{PASSWORD} && ":$ENV{PASSWORD}") . '@'); $ENV{URLPREFIX} = "ftp://$user$ENV{HOST}/$ENV{PREFIX}"; } - if ($method eq 'http' || $method eq 'ftp') { + if (member($method, qw(http ftp))) { { method => $method, url => $ENV{URLPREFIX} }; } elsif ($method =~ /(.*)-iso$/) { my $dir_method = $1; @@ -348,10 +336,10 @@ sub getFile_ { sub get_file_and_size { my ($phys_m, $f) = @_; - if ($f =~ m|^http://|) { + if ($f =~ m|^https?://|) { require install::http; install::http::get_file_and_size($f); - } elsif (member($phys_m->{method}, qw(ftp http))) { + } elsif (member($phys_m->{method}, qw(ftp http https))) { require install::http; install::http::get_file_and_size_($f, $phys_m->{url}); } elsif ($f =~ m!^/!) { @@ -433,12 +421,6 @@ sub urpmidir() { -w $v ? $v : '/tmp'; } -sub hdlist_on_disk { - my ($m) = @_; - - urpmidir() . "/hdlist.$m->{fakemedium}.cz"; -} - sub _allow_copy_rpms_on_disk { my ($medium, $hdlists) = @_; @@ -497,16 +479,14 @@ sub select_only_some_media { } } -sub configure_media { +sub update_media { my ($packages) = @_; urpm::media::update_media($packages, distrib => 1, callback => \&urpm::download::sync_logger) or log::l('updating media failed'); - urpm::media::configure($packages); } sub get_media { my ($o, $media, $packages) = @_; - use Data::Dumper; my ($suppl_CDs, $copy_rpms_on_disk, $phys_m); foreach (@$media) { @@ -544,8 +524,8 @@ sub adjust_paths_in_urpmi_cfg { $medium->{url} =~ s!^.*?/media/!$phys_m->{url}/!; } elsif (member($phys_m->{method}, qw(disk nfs))) { # use the real mount point: - if ($medium->{url} =~ m!/tmp/image!) { - $medium->{url} =~ s!/tmp/image!$phys_m->{mntpoint}!; + if ($medium->{url} =~ m!/tmp/image(/media)?!) { + $medium->{url} =~ s!/tmp/image(/media)?!$phys_m->{mntpoint}$phys_m->{rel_path}!; } else { # just remove $::prefix and we already have the real mount point: $medium->{url} =~ s!^$::prefix!!; @@ -641,7 +621,7 @@ sub _get_media_url { my ($o, $phys_medium) = @_; my $uri; if ($phys_medium->{is_suppl}) { - if (member($phys_medium->{method}, qw(ftp http))) { + if (member($phys_medium->{method}, qw(ftp http https))) { $uri = $phys_medium->{url}; $uri =~ s!/media$!!; } elsif (member($phys_medium->{method}, qw(cdrom nfs))) { @@ -650,8 +630,8 @@ sub _get_media_url { $uri .= "/$arch" if -d "$uri/$arch"; } } 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 = $o->{stage2_phys_medium}{url} =~ m!^(https?|ftp)://! && $o->{stage2_phys_medium}{url} || + $phys_medium->{method} =~ m!^(ftp|https?)://! && $phys_medium->{method} || '/tmp/image'; } $uri; } @@ -668,7 +648,7 @@ sub get_media_cfg { die "media.cfg not found"; } - my $suppl_CDs = exists $o->{supplmedia} ? $o->{supplmedia} : $distribconf->{suppl} || 0; + my $suppl_CDs = defined $o->{supplmedia} ? $o->{supplmedia} : $distribconf->{suppl} || 0; my $deselectionAllowed = $distribconf->{askmedia} || $o->{askmedia} || 0; log::l(Data::Dumper->Dump([ $phys_medium ], [ 'phys_medium' ])); @@ -846,7 +826,7 @@ sub copy_rpms_on_disk { sub _get_medium_dir { my ($phys_m) = @_; - if ($phys_m->{method} eq 'ftp' || $phys_m->{method} eq 'http' || $phys_m->{method} eq 'cdrom') { + if (member($phys_m->{method}, qw(ftp http https cdrom))) { $phys_m->{url}; } else { "$phys_m->{mntpoint}$phys_m->{rel_path}"; |
