[Fai-commit] r6754 - trunk/lib/setup-storage

Michael Tautschnig mt at alioth.debian.org
Sun Oct 23 09:33:58 UTC 2011


Author: mt
Date: 2011-10-23 09:33:58 +0000 (Sun, 23 Oct 2011)
New Revision: 6754

Modified:
   trunk/lib/setup-storage/Volumes.pm
Log:
setup-storage: try to write disklabel in -X mode, regardless of exact error message

setup-storage used to write the disklabel for disks with an unuseable disklabel
only for specific errors reported by parted print; now do it for all errors.
Errors of this write attempt will still be caught. Discussed with Andreas
Schuldei.



Modified: trunk/lib/setup-storage/Volumes.pm
===================================================================
--- trunk/lib/setup-storage/Volumes.pm	2011-10-23 09:09:25 UTC (rev 6753)
+++ trunk/lib/setup-storage/Volumes.pm	2011-10-23 09:33:58 UTC (rev 6754)
@@ -118,14 +118,9 @@
       die "Failed to determine size and contents of $disk, but partitions should have been preserved\n";
     }
 
-    # parted_2 happens when the disk has no disk label, parted_4 means unaligned
-    # partitions
-    if ($error eq "parted_2" || $error eq "parted_2_new" ||
-      $error eq "parted_4" || $error eq "parted_4_new") {
-
-      $FAI::no_dry_run or die 
-        "Can't run on test-only mode on this system because there is no disklabel on $disk\n";
-
+    # write a fresh disklabel if no useable data was found and dry_run is not
+    # set
+    if ($error ne "" && $FAI::no_dry_run) {
       # write the disk label as configured
       my $label = $FAI::configs{"PHY_$disk"}{disklabel};
       $label = "gpt" if ($label eq "gpt-bios");




More information about the Fai-commit mailing list