summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-29 17:04:58 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-29 17:04:58 +0000
commit24d3d1e9799a6a44a390f72b57e146809a8a00a8 (patch)
treeade7b360c3145c8afbe0d15eadc554be77eeae2c
parent0032345eef218f3d803ff9bc9db0a76d5e0f9be1 (diff)
downloadurpmi-24d3d1e9799a6a44a390f72b57e146809a8a00a8.tar
urpmi-24d3d1e9799a6a44a390f72b57e146809a8a00a8.tar.gz
urpmi-24d3d1e9799a6a44a390f72b57e146809a8a00a8.tar.bz2
urpmi-24d3d1e9799a6a44a390f72b57e146809a8a00a8.tar.xz
urpmi-24d3d1e9799a6a44a390f72b57e146809a8a00a8.zip
HAL can fail to umount the cdrom if it was not mounted by HAL.
in that case, use "umount" command directly.
-rw-r--r--urpm/cdrom.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/urpm/cdrom.pm b/urpm/cdrom.pm
index ccbd29dd..c40cd320 100644
--- a/urpm/cdrom.pm
+++ b/urpm/cdrom.pm
@@ -124,7 +124,12 @@ sub _eject_cdrom {
require Hal::Cdroms;
my $hal_cdroms = Hal::Cdroms->new;
- $hal_cdroms->unmount($hal_path);
+ $hal_cdroms->unmount($hal_path) or do {
+ my $mntpoint = $hal_cdroms->get_mount_point($hal_path);
+ #- trying harder. needed when the cdrom was not mounted by hal
+ $mntpoint && system("umount '$mntpoint' 2>/dev/null") == 0
+ or $urpm->{error}("failed to umount $hal_path: $hal_cdroms->{error}");
+ };
$hal_cdroms->eject($hal_path);
1;
}