summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-03-21 13:52:03 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-03-21 13:52:03 +0000
commitb362f2e902df01b5e4caa956bfacfcaba472f775 (patch)
tree423ebaa48c92772ae4619566fcca5f6377cff171 /perl-install
parentc8bee550573f3d94390c51ee0111e3a264c5c680 (diff)
downloaddrakx-b362f2e902df01b5e4caa956bfacfcaba472f775.tar
drakx-b362f2e902df01b5e4caa956bfacfcaba472f775.tar.gz
drakx-b362f2e902df01b5e4caa956bfacfcaba472f775.tar.bz2
drakx-b362f2e902df01b5e4caa956bfacfcaba472f775.tar.xz
drakx-b362f2e902df01b5e4caa956bfacfcaba472f775.zip
Allow to eject non-mounted cdroms
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install_any.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index b8073dac3..5dddb6732 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -904,21 +904,23 @@ sub ejectCdrom {
getFile("XXX"); #- close still opened filehandle
my $cdrom;
if ($o_mountpoint) {
- $cdrom = $o_cdrom || cat_("/proc/mounts") =~ m!(/dev/\S+)\s+(/mnt/cdrom|/tmp/image)! && $1 or return;
+ $cdrom = $o_cdrom || cat_("/proc/mounts") =~ m!(/dev/\S+)\s+(/mnt/cdrom|/tmp/image)! && $1;
} else {
- $cdrom = cat_("/proc/mounts") =~ m!(/dev/$o_cdrom)\s+(/mnt/cdrom|/tmp/image)! && $1 or return;
- $o_mountpoint ||= $2 || '/tmp/image';
+ $cdrom = cat_("/proc/mounts") =~ m!(/dev/$o_cdrom)\s+(/mnt/cdrom|/tmp/image)! && $1;
+ $o_mountpoint ||= $cdrom ? $2 || '/tmp/image' : '';
}
+ $cdrom ||= $o_cdrom;
#- umount BEFORE opening the cdrom device otherwise the umount will
#- D state if the cdrom is already removed
- eval { fs::umount($o_mountpoint) };
+ $o_mountpoint and eval { fs::umount($o_mountpoint) };
$@ and warnAboutFilesStillOpen();
return if is_xbox();
eval {
my $dev = detect_devices::tryOpen($cdrom);
ioctl($dev, c::CDROMEJECT(), 1) if ioctl($dev, c::CDROM_DRIVE_STATUS(), 0) == c::CDS_DISC_OK();
};
+ $@ and log::l("ejection failed: $@");
}
sub warnAboutFilesStillOpen() {