summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-09-03 06:07:37 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-09-03 06:07:37 +0000
commit93d8ec027a9d12a8e58b43a9e46d707aea9d4f39 (patch)
tree904a7617a5b17a8270af3399c8f5519a61e6f37f
parentae54a4db1a853f360a264cbe42eb41bf773d707e (diff)
downloaddrakx-93d8ec027a9d12a8e58b43a9e46d707aea9d4f39.tar
drakx-93d8ec027a9d12a8e58b43a9e46d707aea9d4f39.tar.gz
drakx-93d8ec027a9d12a8e58b43a9e46d707aea9d4f39.tar.bz2
drakx-93d8ec027a9d12a8e58b43a9e46d707aea9d4f39.tar.xz
drakx-93d8ec027a9d12a8e58b43a9e46d707aea9d4f39.zip
Better handling of mounting/umounting supplementary CDs
-rw-r--r--perl-install/install_any.pm16
-rw-r--r--perl-install/pkgs.pm2
2 files changed, 11 insertions, 7 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 13812be85..0585303c8 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -149,9 +149,10 @@ sub errorOpeningFile($) {
my $max = 32; #- always refuse after $max tries.
if ($current_method eq "cdrom") {
- cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image), and $cdrom = $1;
+ cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(/mnt/cdrom|/tmp/image),
+ and ($cdrom, my $mountpoint) = ($1, $2);
return unless $cdrom;
- ejectCdrom($cdrom);
+ ejectCdrom($cdrom, $mountpoint);
while ($max > 0 && askChangeMedium($current_method, $asked_medium)) {
$current_medium = $asked_medium;
mountCdrom("/tmp/image");
@@ -159,7 +160,7 @@ sub errorOpeningFile($) {
$getFile && @advertising_images and copy_advertising($::o);
$getFile and return $getFile;
$current_medium = 'unknown'; #- don't know what CD is inserted now.
- ejectCdrom($cdrom);
+ ejectCdrom($cdrom, $mountpoint);
--$max;
}
} else {
@@ -433,6 +434,7 @@ sub selectSupplMedia {
devices::make($cdrom);
ejectCdrom($cdrom);
if ($o->ask_okcancel('', N("Insert the CD"), 1)) {
+ #- mount suppl CD in /mnt/cdrom to avoid umounting /tmp/image
mountCdrom("/mnt/cdrom", $cdrom);
log::l($@) if $@;
useMedium($medium_name);
@@ -704,14 +706,16 @@ sub unlockCdrom() {
my $cdrom = cat_("/proc/mounts") =~ m!(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image)! && $1 or return;
eval { ioctl(detect_devices::tryOpen($cdrom), c::CDROM_LOCKDOOR(), 0) };
}
+
sub ejectCdrom {
- my ($o_cdrom) = @_;
+ my ($o_cdrom, $o_mountpoint) = @_;
getFile("XXX"); #- close still opened filehandle
- my $cdrom = $o_cdrom || cat_("/proc/mounts") =~ m!(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image)! && $1 or return;
+ my $cdrom = $o_cdrom || cat_("/proc/mounts") =~ m!(/(?:dev|tmp)/\S+)\s+(/mnt/cdrom|/tmp/image)! && $1 or return;
+ $o_mountpoint ||= $2 || '/tmp/image';
#- umount BEFORE opening the cdrom device otherwise the umount will
#- D state if the cdrom is already removed
- eval { fs::umount("/tmp/image") };
+ eval { fs::umount($o_mountpoint) };
$@ and warnAboutFilesStillOpen();
eval {
my $dev = detect_devices::tryOpen($cdrom);
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 51b3e241d..87f29b11f 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -948,7 +948,7 @@ sub installTransactionClosure {
$cdrom = $cdromdev->{device};
log::l("cdrom redetected at $cdrom");
devices::make($cdrom);
- install_any::ejectCdrom($cdrom) if $::o->{method} eq 'cdrom'; # will umount /tmp/image
+ install_any::ejectCdrom($cdrom) if $::o->{method} eq 'cdrom';
install_any::mountCdrom("/mnt/cdrom", $cdrom);
} else { log::l("cdrom already found at $cdrom") }
'cdrom';