diff options
author | Olivier Blin <oblin@mandriva.com> | 2009-07-31 13:52:02 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2009-07-31 13:52:02 +0000 |
commit | 3070a3954bdbd203f359ea6990c653a65605a5f1 (patch) | |
tree | fdbcbc9da507ed2d9c4e974efe2e0ec6264a8565 | |
parent | 880f6803f05d9063ab6b25701aa444de86c029a1 (diff) | |
download | draklive-3070a3954bdbd203f359ea6990c653a65605a5f1.tar draklive-3070a3954bdbd203f359ea6990c653a65605a5f1.tar.gz draklive-3070a3954bdbd203f359ea6990c653a65605a5f1.tar.bz2 draklive-3070a3954bdbd203f359ea6990c653a65605a5f1.tar.xz draklive-3070a3954bdbd203f359ea6990c653a65605a5f1.zip |
always compute master size from pre-computed partition sizes
-rwxr-xr-x | draklive | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -678,7 +678,7 @@ sub allocate_partition { } sub allocate_master { - my ($live, $media, $dest, $total_size) = @_; + my ($live, $media, $dest) = @_; mkdir_p(dirname($dest)); my $geom = { heads => 16, @@ -688,7 +688,7 @@ sub allocate_master { my $track_size = $sector_size * $geom->{sectors}; my $cylinder_size = $track_size * $geom->{heads}; - my $disk_size = $total_size + $track_size; + my $disk_size = $track_size + fold_left { $::a + $::b } map { $_->{size} * $common::SECTORSIZE } @{$live->{media}{partitions}}; $geom->{cylinders} = int($disk_size / $cylinder_size); MDV::Draklive::Utils::device_allocate_file($dest, $disk_size); @@ -729,9 +729,7 @@ sub create_disk_master { $live->{media}->supplement_partitions($slash_size); my $dest = get_disk_master_path($live); - my $disk_size = fold_left { $::a + $::b } map { $_->{size} * $common::SECTORSIZE } @{$live->{media}{partitions}}; - - my @loops = allocate_master($live, $live->{media}, $dest, $disk_size); + my @loops = allocate_master($live, $live->{media}, $dest); my $slash_idx = $live->{media}->find_partition_index('/'); local $opts->{device} = $loops[$slash_idx]; local $opts->{disk_device} = $dest; @@ -1124,7 +1122,7 @@ sub create_usb_replicator { my $size = fold_left { $::a + $::b } map { directory_usage($_, 'apparent') } keys(%files); $live->{replicator}{media}->supplement_partitions($size); - my @loops = allocate_master($live, $live->{replicator}{media}, $dest, $size); + my @loops = allocate_master($live, $live->{replicator}{media}, $dest); my $slash_idx = $live->{replicator}{media}->find_partition_index('/'); my $opts = { device => $loops[$slash_idx], disk_device => $dest, append => $live->{replicator}{append} }; record_usb_replicator($live, $opts); |