[Fai-commit] r6257 - branches/stable/3.4/lib/setup-storage

Michael Prokop mika at alioth.debian.org
Fri Dec 24 10:53:35 UTC 2010


Author: mika
Date: 2010-12-24 10:53:34 +0000 (Fri, 24 Dec 2010)
New Revision: 6257

Modified:
   branches/stable/3.4/lib/setup-storage/Commands.pm
Log:
setup-storage/Commands.pm: Rebuild partition table only once, unless necessary
for resizing; also fixes perl compilation error.

Closes: #607901
Thanks: Toomas Tamm <tt-fai at kky.ttu.ee>

Modified: branches/stable/3.4/lib/setup-storage/Commands.pm
===================================================================
--- branches/stable/3.4/lib/setup-storage/Commands.pm	2010-12-23 22:19:29 UTC (rev 6256)
+++ branches/stable/3.4/lib/setup-storage/Commands.pm	2010-12-24 10:53:34 UTC (rev 6257)
@@ -882,6 +882,12 @@
 
   # the list of partitions that must be preserved
   my @to_preserve = &FAI::get_preserved_partitions($config);
+  # resize needed?
+  my $needs_resize = 0;
+  foreach my $part_id (@to_preserve) {
+    $needs_resize = 1 if ($FAI::configs{$config}{partitions}{$part_id}{size}{resize});
+    last if ($needs_resize);
+  }
 
   my $label = $FAI::configs{$config}{disklabel};
   $label = "gpt" if ($label eq "gpt-bios");
@@ -892,10 +898,10 @@
     or die "Can't change disklabel, partitions are to be preserved\n";
 
   # write the disklabel to drop the previous partition table
-  &FAI::push_command( "parted -s $disk mklabel $label",
+  &FAI::push_command( ($needs_resize ? "parted -s $disk mklabel $label" : "true"),
     "exist_$disk,all_pv_sigs_removed", "cleared1_$disk" );
 
-  &FAI::rebuild_preserved_partitions($config, \@to_preserve);
+  &FAI::rebuild_preserved_partitions($config, \@to_preserve) if ($needs_resize);
 
   my $pre_all_resize = "";
 




More information about the Fai-commit mailing list