diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-07-26 01:07:52 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2004-07-26 01:07:52 +0000 |
commit | 0e345d483f0116470e3b5438696f5b7699fd20dd (patch) | |
tree | 6d27c920ca44544f840eaecec7656a857eecabb9 /urpm.pm | |
parent | c9e54f593e541564010e63a27516ad5442087cf7 (diff) | |
download | urpmi-0e345d483f0116470e3b5438696f5b7699fd20dd.tar urpmi-0e345d483f0116470e3b5438696f5b7699fd20dd.tar.gz urpmi-0e345d483f0116470e3b5438696f5b7699fd20dd.tar.bz2 urpmi-0e345d483f0116470e3b5438696f5b7699fd20dd.tar.xz urpmi-0e345d483f0116470e3b5438696f5b7699fd20dd.zip |
Media reconfiguration: for local media, verify that the new url points to
an existing directory.
Diffstat (limited to 'urpm.pm')
-rw-r--r-- | urpm.pm | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -849,9 +849,11 @@ sub _probe_with_try_list { } #- read a reconfiguration file for urpmi, and reconfigure media accordingly +#- $rfile is the reconfiguration file (local), $name is the media name sub reconfig_urpmi { my ($urpm, $rfile, $name) = @_; my @replacements; + my @reconfigurable = qw(url with_hdlist clear_url); my $reconfigured = 0; open my $fh, $rfile or return undef; $urpm->{log}(N("reconfiguring urpmi for media \"%s\"", $name)); @@ -863,9 +865,11 @@ sub reconfig_urpmi { $f ||= 1; push @replacements, [ quotemeta $p, $r, $f ]; } + MEDIA: for my $medium (grep { $_->{name} eq $name } @{$urpm->{media}}) { + my %orig = map { $_ => $medium->{$_} } @reconfigurable; URLS: - for my $k (qw(url with_hdlist clear_url)) { + for my $k (@reconfigurable) { for my $r (@replacements) { if ($medium->{$k} =~ s/$r->[0]/$r->[1]/) { $reconfigured = 1; @@ -874,6 +878,13 @@ sub reconfig_urpmi { redo URLS if $r->[2] =~ /N/; } } + #- check that the new url exists before committing changes (local mirrors) + if ($medium->{$k} =~ m#^file:/*(/[^/].*[^/])/*$# && !-e $1) { + $medium->{$k} = $orig{$k} for @reconfigurable; + $reconfigured = 0; + $urpm->{log}(N("...reconfiguration failed")); + last MEDIA; + } } } close $fh; |