diff options
-rwxr-xr-x | draklive | 2 | ||||
-rw-r--r-- | lib/MDV/Draklive/Utils.pm | 6 |
2 files changed, 6 insertions, 2 deletions
@@ -993,7 +993,7 @@ sub create_usb_replicator { my ($live) = @_; my $dest = get_disk_replicator_path($live); my %files = get_disk_replicator_files($live); - my $size = fold_left { $::a + $::b } map { directory_usage($_) } keys(%files); + my $size = fold_left { $::a + $::b } map { directory_usage($_, 'apparent') } keys(%files); my $loop = allocate_master($dest, 5000000 + $size, 'vfat'); my $opts = { device => $loop, disk_device => $dest, append => $live->{replicator}{append} }; record_usb_replicator($live, $opts); diff --git a/lib/MDV/Draklive/Utils.pm b/lib/MDV/Draklive/Utils.pm index 7341e34..8e9ed65 100644 --- a/lib/MDV/Draklive/Utils.pm +++ b/lib/MDV/Draklive/Utils.pm @@ -10,7 +10,11 @@ use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(directory_usage run_ run_foreach); -sub directory_usage { first(split /\s/, `du -s -B 1 $_[0]`) } +sub directory_usage { + my ($dir, $o_apparent) = @_; + my $apparent = $o_apparent && "--apparent-size"; + first(split /\s/, `du -s -B 1 $apparent $_[0]`); + } #- expand only if the pattern contains '*' #- and matches dot characters (like shell dotglob) |