From 41d805add5f0d4d8be3570164110c453865b42c3 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 6 Apr 2009 18:00:48 +0000 Subject: (_adjust_paths_in_urpmi_cfg) change it so that it consider per medium physical medium instead of global medium ; fix path of NFS media after installation (setPackages) adjust paths in urpmi.cfg there instead of within get_media() --- perl-install/install/NEWS | 1 + perl-install/install/any.pm | 1 + perl-install/install/media.pm | 27 +++++++++++++-------------- 3 files changed, 15 insertions(+), 14 deletions(-) (limited to 'perl-install/install') diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 25c4ca298..a6b76c2a4 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,4 +1,5 @@ - media management: + o fix path of NFS media after installation o use urpmi in order to add supplementary media - put distro version after release because release contains "Mandriva Linux" diff --git a/perl-install/install/any.pm b/perl-install/install/any.pm index 2698317e6..bb2ddfcf5 100644 --- a/perl-install/install/any.pm +++ b/perl-install/install/any.pm @@ -323,6 +323,7 @@ sub setPackages { urpm::media::update_media($o->{packages}, distrib => 1, callback => \&urpm::download::sync_logger) or log::l('updating media failed'); + install::media::adjust_paths_in_urpmi_cfg($o->{packages}); urpm::media::configure($o->{packages}); log::l('urpmi completely set up'); diff --git a/perl-install/install/media.pm b/perl-install/install/media.pm index 2aaa77e51..bed27116d 100644 --- a/perl-install/install/media.pm +++ b/perl-install/install/media.pm @@ -515,28 +515,27 @@ sub get_media { log::l("unknown media type $_->{type}, skipping"); } } - my @new_media = difference2([ map { $_->{name} } @{$packages->{media}} ], \@names); - - - _adjust_paths_in_urpmi_cfg($o, $phys_m, @new_media); log::l("suppl_CDs=$suppl_CDs copy_rpms_on_disk=$copy_rpms_on_disk"); $suppl_CDs, $copy_rpms_on_disk; } -sub _adjust_paths_in_urpmi_cfg { - my ($o, $phys_m, @new_media) = @_; - if ($o->{stage2_phys_medium}{method} eq 'cdrom') { - my $urpm = install::pkgs::empty_packages(); - # force rereading media: - undef $urpm->{media}; - urpm::media::read_config($urpm); - foreach my $medium (@{$urpm->{media}}) { - next if !member($medium->{name}, @new_media); +sub adjust_paths_in_urpmi_cfg { + my ($packages) = @_; + + require Clone; + my ($urpm) = Clone::clone($packages); + foreach my $medium (@{$urpm->{media}}) { + my $phys_m = $medium->{phys_medium}; + my $dir = _get_medium_dir($phys_m); + my $old_url = $medium->{url}; + if ($phys_m->{method} eq 'cdrom') { $medium->{url} =~ s!^$phys_m->{real_mntpoint}/!cdrom://!; + } elsif ($phys_m->{method} eq 'nfs') { + $medium->{url} =~ s!^$::prefix!!; } - urpm::media::write_config($urpm); } + urpm::media::write_config($urpm); } sub remove_from_fstab { -- cgit v1.2.1