| 1 |
2010-07-02 Michael Tautschnig <mt@debian.org>
|
| 2 |
|
| 3 |
* setup-storage/Commands.pm: Rebuild partition table only once, unless
|
| 4 |
necessary for resizing (thanks Toomas Tamm <tt-fai@kky.ttu.ee> for
|
| 5 |
insisting).
|
| 6 |
Index: trunk/lib/setup-storage/Commands.pm
|
| 7 |
===================================================================
|
| 8 |
--- trunk.orig/lib/setup-storage/Commands.pm
|
| 9 |
+++ trunk/lib/setup-storage/Commands.pm
|
| 10 |
@@ -870,6 +870,12 @@
|
| 11 |
|
| 12 |
# the list of partitions that must be preserved
|
| 13 |
my @to_preserve = &FAI::get_preserved_partitions($config);
|
| 14 |
+ # resize needed?
|
| 15 |
+ my $needs_resize = 0;
|
| 16 |
+ foreach my $part_id (@to_preserve) {
|
| 17 |
+ $needs_resize = 1 if ($FAI::configs{$config}{partitions}{$part_id}{size}{resize});
|
| 18 |
+ last if ($needs_resize);
|
| 19 |
+ }
|
| 20 |
|
| 21 |
my $label = $FAI::configs{$config}{disklabel};
|
| 22 |
$label = "gpt" if ($label eq "gpt-bios");
|
| 23 |
@@ -880,10 +886,10 @@
|
| 24 |
or die "Can't change disklabel, partitions are to be preserved\n";
|
| 25 |
|
| 26 |
# write the disklabel to drop the previous partition table
|
| 27 |
- &FAI::push_command( "parted -s $disk mklabel $label",
|
| 28 |
+ &FAI::push_command( ($needs_resize ? "parted -s $disk mklabel $label" : "true"),
|
| 29 |
"exist_$disk,all_pv_sigs_removed", "cleared1_$disk" );
|
| 30 |
|
| 31 |
- &FAI::rebuild_preserved_partitions($config, \@to_preserve);
|
| 32 |
+ &FAI::rebuild_preserved_partitions($config, \@to_preserve) if ($needs_resize);
|
| 33 |
|
| 34 |
my $pre_all_resize = "";
|
| 35 |
|