diff options
-rw-r--r-- | perl-install/install/media.pm | 31 | ||||
-rw-r--r-- | perl-install/install/pkgs.pm | 6 |
2 files changed, 33 insertions, 4 deletions
diff --git a/perl-install/install/media.pm b/perl-install/install/media.pm index 3cd65aa9c..43bf5aef0 100644 --- a/perl-install/install/media.pm +++ b/perl-install/install/media.pm @@ -8,6 +8,7 @@ our @EXPORT_OK = qw(getFile_ getAndSaveFile_ getAndSaveFile_media_info packageMe use common; use fs::type; use urpm::download; +use urpm::media; #- list of fields for {phys_medium} : #- device @@ -483,7 +484,11 @@ sub get_media { foreach (@$media) { if ($_->{type} eq 'media_cfg') { my $phys_m = url2mounted_phys_medium($o, $_->{url}, 'media_info'); - ($suppl_CDs, $copy_rpms_on_disk) = get_media_cfg($o, $phys_m, $packages, $_->{selected_names}, $_->{force_rpmsrate}); + my $uri = $phys_m->{method} =~ m!^(ftp|http)://! && $phys_m->{method} + || $phys_m->{real_mntpoint} || $phys_m->{url}; + urpm::media::add_distrib_media($packages, undef, $uri, ask_media => undef); #allmedia => 1 + _get_compsUsers_pl($phys_m, $_->{force_rpmsrate}); + ($suppl_CDs, $copy_rpms_on_disk) = eval { _get_media_cfg_options($o, $phys_m) }; } elsif ($_->{type} eq 'media') { my $phys_m = url2mounted_phys_medium($o, $_->{url}); get_standalone_medium($o, $phys_m, $packages, { name => $_->{id} =~ /media=(.*)/ && $1 }); @@ -498,6 +503,13 @@ sub get_media { log::l("unknown media type $_->{type}, skipping"); } } + + urpm::media::update_media($packages, distrib => 1, callback => \&urpm::download::sync_logger) or + log::l('updating media failed'); + + urpm::media::configure($packages); + log::l('urpmi completely set up'); + log::l("suppl_CDs=$suppl_CDs copy_rpms_on_disk=$copy_rpms_on_disk"); $suppl_CDs, $copy_rpms_on_disk; } @@ -584,6 +596,23 @@ sub _url2phys_medium { } } +# shrinked down get_media_cfg() in order to keep optins that urpmi discards: +sub _get_media_cfg_options { + my ($o, $phys_medium) = @_; + + my ($distribconf); + if (getAndSaveFile_($phys_medium, 'media_info/media.cfg', '/tmp/media.cfg')) { + ($distribconf) = _parse_media_cfg('/tmp/media.cfg', $phys_medium); + } else { + die "media.cfg not found"; + } + + my $suppl_CDs = exists $o->{supplmedia} ? $o->{supplmedia} : $distribconf->{suppl} || 0; + + $suppl_CDs, $o->{copy_rpms_on_disk}; +} + + sub get_media_cfg { my ($o, $phys_medium, $packages, $selected_names, $force_rpmsrate) = @_; diff --git a/perl-install/install/pkgs.pm b/perl-install/install/pkgs.pm index fd33aab1f..af4f8d6c5 100644 --- a/perl-install/install/pkgs.pm +++ b/perl-install/install/pkgs.pm @@ -125,7 +125,7 @@ sub packagesToInstall { my ($packages) = @_; my @packages; foreach (@{$packages->{media}}) { - $_->{selected} or next; + !$_->{ignore} or next; log::l("examining packagesToInstall of medium $_->{name}"); push @packages, grep { $_->flag_selected } install::media::packagesOfMedium($packages, $_); } @@ -142,7 +142,7 @@ sub _packageRequest { #- check for medium selection, if the medium has not been #- selected, the package cannot be selected. - packageMedium($packages, $pkg)->{selected} or return; + !packageMedium($packages, $pkg)->{ignore} or return; +{ $pkg->id => 1 }; } @@ -633,7 +633,7 @@ sub selectPackagesToUpgrade { sub _filter_packages { my ($retry, $packages, @packages) = @_; grep { - if ($_->flag_installed || !packageMedium($packages, $_)->{selected}) { + if ($_->flag_installed || packageMedium($packages, $_)->{ignore}) { if ($_->name eq 'mdv-rpm-summary' && $_->flag_installed) { install::pkgs::setup_rpm_summary_translations(); } |