From 995ea591c5076d0a1f809f4b0c5d919db7510c88 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 6 Aug 2000 23:22:23 +0000 Subject: no_comment --- perl-install/fs.pm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'perl-install/fs.pm') 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) = @_; -- cgit v1.2.1