summaryrefslogtreecommitdiffstats
path: root/perl-install/fs.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-08-06 23:22:23 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-08-06 23:22:23 +0000
commit995ea591c5076d0a1f809f4b0c5d919db7510c88 (patch)
treee32a887a5e46515dbee32d4b4825f1b91c1ab61d /perl-install/fs.pm
parent21fbfdfead833c685b255edb3c3460198ce89877 (diff)
downloaddrakx-995ea591c5076d0a1f809f4b0c5d919db7510c88.tar
drakx-995ea591c5076d0a1f809f4b0c5d919db7510c88.tar.gz
drakx-995ea591c5076d0a1f809f4b0c5d919db7510c88.tar.bz2
drakx-995ea591c5076d0a1f809f4b0c5d919db7510c88.tar.xz
drakx-995ea591c5076d0a1f809f4b0c5d919db7510c88.zip
no_comment
Diffstat (limited to 'perl-install/fs.pm')
-rw-r--r--perl-install/fs.pm29
1 files changed, 29 insertions, 0 deletions
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 9d3c38049..3d9628071 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -305,6 +305,35 @@ sub umount_all($;$) {
}
}
+sub df {
+ my ($part, $prefix) = @_;
+ my $dir = "/tmp/tmp_fs_df";
+
+ return $part->{free} if exists $part->{free};
+
+ if ($part->{isMounted}) {
+ $dir = ($prefix || '') . $part->{mntpoint};
+ } elsif ($part->{notFormatted} && !$part->{isFormatted}) {
+ return; #- won't even try!
+ } else {
+ mkdir $dir;
+ eval { mount($part->{device}, $dir, type2fs($part->{type}), 'readonly') };
+ if ($@) {
+ unlink $dir;
+ return;
+ }
+ }
+ my (undef, $free) = common::df($dir);
+
+ if (!$part->{isMounted}) {
+ umount($dir);
+ unlink($dir)
+ }
+
+ $part->{free} = 2 * $free if defined $free;
+ $part->{free};
+}
+
#- do some stuff before calling write_fstab
sub write($$$$) {
my ($prefix, $fstab, $manualFstab, $useSupermount) = @_;