forked from josch/mmdebstrap
Return the same block number irrespective of what is in /dev
Depending on the mode an on whether mknod works (mount options of $TMPDIR) different stuff might be in /dev. To make the blocksize in of the ext2 output format reproducible, ignore the content of /dev.
This commit is contained in:
parent
af5841269c
commit
08319f6c77
1 changed files with 3 additions and 1 deletions
|
@ -2857,8 +2857,10 @@ sub guess_sources_format {
|
||||||
sub approx_disk_usage {
|
sub approx_disk_usage {
|
||||||
my $directory = shift;
|
my $directory = shift;
|
||||||
info "approximating disk usage...";
|
info "approximating disk usage...";
|
||||||
|
# to return the same number of blocks irrespective of the chosen mode
|
||||||
|
# we exclude /dev from being counted
|
||||||
open my $fh, '-|', 'du', '--block-size', '1024',
|
open my $fh, '-|', 'du', '--block-size', '1024',
|
||||||
'--summarize', '--one-file-system',
|
"--exclude=$directory/dev", '--summarize', '--one-file-system',
|
||||||
$directory // error "failed to fork(): $!";
|
$directory // error "failed to fork(): $!";
|
||||||
chomp(
|
chomp(
|
||||||
my $du = do { local $/; <$fh> }
|
my $du = do { local $/; <$fh> }
|
||||||
|
|
Loading…
Reference in a new issue