diff options
-rw-r--r-- | urpm/media.pm | 8 | ||||
-rw-r--r-- | urpm/removable.pm | 15 |
2 files changed, 9 insertions, 14 deletions
diff --git a/urpm/media.pm b/urpm/media.pm index f182a2c7..0ee2eba9 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -51,6 +51,7 @@ sub _only_media_opts_read { my ($m) = @_; my $c = only_media_opts($m); $c->{media_info_dir} ||= 'media_info'; + $c->{iso} = delete $c->{removable} if $c->{removable} && urpm::removable::is_iso($c->{removable}); $c; } sub _only_media_opts_write { @@ -58,6 +59,7 @@ sub _only_media_opts_write { my $c = only_media_opts($m); delete $c->{media_info_dir} if $c->{media_info_dir} eq 'media_info'; delete $c->{url} if $c->{mirrorlist}; + $c->{removable} = delete $c->{iso} if $c->{iso}; $c; } @@ -403,9 +405,7 @@ sub probe_removable_device { #- try to find device to open/close for removable medium. if (my $dir = file_from_local_url($medium->{url})) { - if (urpm::removable::is_iso($medium->{removable})) { - $urpm->{log}(N("Medium \"%s\" is an ISO image, will be mounted on-the-fly", $medium->{name})); - } elsif (my $entry = urpm::sys::find_a_mntpoint($dir)) { + if (my $entry = urpm::sys::find_a_mntpoint($dir)) { if ($medium->{removable} && $medium->{removable} ne $entry->{device}) { $urpm->{log}(N("using different removable device [%s] for \"%s\"", $entry->{device}, $medium->{name})); @@ -1246,7 +1246,7 @@ sub _update_medium__parse_if_unmodified__local { #- everything that might be necessary. urpm::removable::try_mounting($urpm, $dir, - $medium->{removable}, + $medium->{iso}, ) or $urpm->{error}(N("unable to access medium \"%s\", this could happen if you mounted manually the directory when creating the medium.", $medium->{name})), return; } diff --git a/urpm/removable.pm b/urpm/removable.pm index bddd8e1d..77fb5300 100644 --- a/urpm/removable.pm +++ b/urpm/removable.pm @@ -18,18 +18,13 @@ sub is_iso { $removable_dev && $removable_dev =~ /\.iso$/i; } -sub is_cdrom { - my ($removable_dev) = @_; - $removable_dev && !is_iso($removable_dev); -} - #- side-effects: #- + those of try_mounting_ ($urpm->{removable_mounted}, "mount") #- + those of try_mounting_iso ($urpm->{removable_mounted}, "mount") sub try_mounting { - my ($urpm, $dir, $o_removable) = @_; + my ($urpm, $dir, $o_iso) = @_; - is_iso($o_removable) ? try_mounting_iso($urpm, $dir, $o_removable) : try_mounting_($urpm, $dir); + $o_iso ? try_mounting_iso($urpm, $dir, $o_iso) : try_mounting_($urpm, $dir); } #- side-effects: $urpm->{removable_mounted}, "mount" @@ -223,7 +218,7 @@ sub try_mounting_non_cdroms { my @used_media = map { $_->{medium} } _create_blists($urpm->{media}, $list); - foreach my $medium (grep { !is_cdrom($_->{removable}) } @used_media) { + foreach my $medium (grep { !$_->{removable} } @used_media) { try_mounting_non_cdrom($urpm, $medium); } } @@ -235,7 +230,7 @@ sub try_mounting_non_cdrom { my $dir = file_from_local_url($medium->{url}) or return; - -e $dir || try_mounting($urpm, $dir, $medium->{removable}) or + -e $dir || try_mounting($urpm, $dir, $medium->{iso}) or $urpm->{error}(N("unable to access medium \"%s\"", $medium->{name})), return; 1; @@ -250,7 +245,7 @@ sub _get_cdroms { foreach (@$blists) { #- examine non removable device but that may be mounted. if (my $device = $_->{medium}{removable}) { - next if is_iso($device) || $device =~ m![^a-zA-Z0-9_./-]!; #- bad path + next if $device =~ m![^a-zA-Z0-9_./-]!; #- bad path push @{$removables{$device} ||= []}, $_; } } |