diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2000-03-14 09:25:40 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2000-03-14 09:25:40 +0000 |
commit | e2cbffc6422fc59ee624c2c399e79109c21c7cc4 (patch) | |
tree | 8bc16a2c6a23da765f7bd7ca08b5ad5dc676b6c5 /perl-install/fs.pm | |
parent | 9266168309a593e84c47cc59edb2a6ccd49e4686 (diff) | |
download | drakx-backup-do-not-use-e2cbffc6422fc59ee624c2c399e79109c21c7cc4.tar drakx-backup-do-not-use-e2cbffc6422fc59ee624c2c399e79109c21c7cc4.tar.gz drakx-backup-do-not-use-e2cbffc6422fc59ee624c2c399e79109c21c7cc4.tar.bz2 drakx-backup-do-not-use-e2cbffc6422fc59ee624c2c399e79109c21c7cc4.tar.xz drakx-backup-do-not-use-e2cbffc6422fc59ee624c2c399e79109c21c7cc4.zip |
no_comment
Diffstat (limited to 'perl-install/fs.pm')
-rw-r--r-- | perl-install/fs.pm | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 7fc15dcec..855fb5fd0 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -135,12 +135,16 @@ sub format_part { sub formatMount_part { my ($part, $raid, $fstab, $prefix, $callback) = @_; - if (my $p = up_mount_point($part->{mntpoint}, $fstab)) { - formatMount_part($p, $raid, $fstab, $prefix, $callback); - } + log::l("formatMount_part: $part->{mntpoint}\n"); + if (isLoopback($part)) { formatMount_part($part->{device}, $raid, $fstab, $prefix, $callback); } + if (my $p = up_mount_point($part->{mntpoint}, $fstab)) { + formatMount_part($p, $raid, $fstab, $prefix, $callback) unless loopback::carryRootLoopback($part); + } + + log::l("formatMount_part: $part->{mntpoint} really\n"); if ($part->{toFormat}) { $callback->($part) if $callback; @@ -153,6 +157,9 @@ sub formatMount_all { my ($raid, $fstab, $prefix, $callback) = @_; formatMount_part($_, $raid, $fstab, $prefix, $callback) foreach sort { isLoopback($a) ? 1 : -1 } grep { $_->{mntpoint} } @$fstab; + + #- ensure the link is there + loopback::carryRootCreateSymlink($_, $prefix) foreach @$fstab; } sub mount($$$;$) { @@ -202,7 +209,10 @@ sub umount($) { sub mount_part($;$$) { my ($part, $prefix, $rdonly) = @_; - $part->{isMounted} and return; + #- root carrier's link can't be mounted + loopback::carryRootCreateSymlink($part, $prefix); + + return if $part->{isMounted}; unless ($::testing) { if (isSwap($part)) { @@ -210,11 +220,15 @@ sub mount_part($;$$) { } else { $part->{mntpoint} or die "missing mount point"; - eval { modules::load('loop') } if isLoopback($part); - $part->{real_device} = devices::set_loop($prefix . loopback::file($part)) || die if isLoopback($part); - local $part->{device} = $part->{real_device} if isLoopback($part); - - mount(devices::make($part->{device}), ($prefix || '') . $part->{mntpoint}, type2fs($part->{type}), $rdonly); + my $dev = $part->{device}; + my $mntpoint = ($prefix || '') . $part->{mntpoint}; + if (isLoopback($part)) { + eval { modules::load('loop') }; + $dev = $part->{real_device} = devices::set_loop($prefix . loopback::file($part)) || die; + } elsif (loopback::carryRootLoopback($part)) { + $mntpoint = "/initrd/loopfs"; + } + mount(devices::make($dev), $mntpoint, type2fs($part->{type}), $rdonly); } } $part->{isMounted} = $part->{isFormatted} = 1; #- assume that if mount works, partition is formatted @@ -228,6 +242,8 @@ sub umount_part($;$) { unless ($::testing) { if (isSwap($part)) { swap::swapoff($part->{device}); + } elsif (loopback::carryRootLoopback($part)) { + umount("/initrd/loopfs"); } else { umount(($prefix || '') . $part->{mntpoint} || devices::make($part->{device})); c::del_loop(delete $part->{real_device}) if isLoopback($part); @@ -321,10 +337,15 @@ sub write_fstab($;$$) { isNfs($_) and $dir = '', $options = $_->{options} || 'ro,nosuid,rsize=8192,wsize=8192'; isFat($_) and $options = $_->{options} || "user,exec"; - my $dev = isLoopback($_) ? loopback::file($_) : - $_->{device} =~ /^\// ? $_->{device} : "$dir$_->{device}"; + my $dev = isLoopback($_) ? + ($_->{mntpoint} eq '/' ? "/initrd/loopfs$_->{loopback_file}" : loopback::file($_)) : + ($_->{device} =~ /^\// ? $_->{device} : "$dir$_->{device}"); - add_options($options, "loop") if isLoopback($_); + local $_->{mntpoint} = do { + $passno = 0; + "/initrd/loopfs" } if loopback::carryRootLoopback($_); + + add_options($options, "loop") if isLoopback($_) && !isSwap($_); #- no need for loop option for swap files #- keep in mind the new line for fstab. @new{($_->{mntpoint}, $dev)} = undef; |