summaryrefslogtreecommitdiffstats
path: root/perl-install/fs.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>1999-09-28 15:53:43 +0000
committerFrancois Pons <fpons@mandriva.com>1999-09-28 15:53:43 +0000
commit99c9b0680ce235c7e5bb6d18a8154a147e70947c (patch)
treee42f58e16872cdf6f4030936f9050ebc5bb99b20 /perl-install/fs.pm
parent4d1e2e9740a607609d497adf72dbef43e9f1a4c8 (diff)
downloaddrakx-99c9b0680ce235c7e5bb6d18a8154a147e70947c.tar
drakx-99c9b0680ce235c7e5bb6d18a8154a147e70947c.tar.gz
drakx-99c9b0680ce235c7e5bb6d18a8154a147e70947c.tar.bz2
drakx-99c9b0680ce235c7e5bb6d18a8154a147e70947c.tar.xz
drakx-99c9b0680ce235c7e5bb6d18a8154a147e70947c.zip
*** empty log message ***
Diffstat (limited to 'perl-install/fs.pm')
-rw-r--r--perl-install/fs.pm23
1 files changed, 21 insertions, 2 deletions
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 3e0d82c8b..23ef5e380 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -39,7 +39,7 @@ sub check_mounted($) {
open H, "/proc/swaps";
foreach (<F>, <G>, <H>) {
foreach my $p (@$fstab) {
- /$p->{device}\s/ and $p->{isMounted} = $p->{isFormatted} = 1;
+ /$p->{device}\s+([^\s]*)\s+/ and $p->{currentMntpoint} = $1, $p->{isMounted} = $p->{isFormatted} = 1;
}
}
}
@@ -130,6 +130,7 @@ sub mount($$$;$) {
#- takes the mount point to umount (can also be the device)
sub umount($) {
my ($mntpoint) = @_;
+ log::l("calling umount($mntpoint)");
syscall_('umount', $mntpoint) or die _("error unmounting %s: %s", $mntpoint, "$!");
my @mtab = cat_('/etc/mtab'); #- don't care about error, if we can't read, we won't manage to write... (and mess mtab)
@@ -147,7 +148,8 @@ sub mount_part($;$) {
swap::swapon($part->{device});
} else {
$part->{mntpoint} or die "missing mount point";
- mount(devices::make($part->{device}), ($prefix || '') . $part->{mntpoint}, type2fs($part->{type}), 0);
+ mount(devices::make($part->{device}), ($prefix || '') . $part->{mntpoint}, type2fs($part->{type}),
+ $part->{mntreadonly} ? 1 : 0);
}
$part->{isMounted} = $part->{isFormatted} = 1; #- assume that if mount works, partition is formatted
}
@@ -252,3 +254,20 @@ sub write_fstab($;$$) {
}
print F join(" ", @$_), "\n" foreach @to_add;
}
+
+sub check_mount_all_fstab($;$) {
+ my ($fstab, $prefix) = @_;
+ $prefix ||= '';
+
+ foreach (sort { ($a->{mntpoint} || '') cmp ($b->{mntpoint} || '') } @$fstab) {
+ #- avoid unwanted mount in fstab.
+ next if ($_->{device} =~ /none/ || $_->{type} =~ /nfs|smbfs|ncpfs|proc/ || $_->{options} =~ /noauto|ro/);
+
+ #- TODO fsck
+
+ eval { mount(devices::make($_->{device}), $prefix . $_->{mntpoint}, $_->{type}, 0); };
+ if ($@) {
+ log::l("unable to mount partition $_->{device} on $prefix/$_->{mntpoint}");
+ }
+ }
+}