[Fai-commit] r3634 - people/michael/features/setup_harddisks_2/implementation

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Sat Jul 22 23:48:45 UTC 2006


Author: michael-guest
Date: 2006-07-22 23:48:45 +0000 (Sat, 22 Jul 2006)
New Revision: 3634

Modified:
   people/michael/features/setup_harddisks_2/implementation/shdd2-exec
   people/michael/features/setup_harddisks_2/implementation/shdd2-sizes
Log:


Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-exec
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-exec	2006-07-22 23:30:24 UTC (rev 3633)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-exec	2006-07-22 23:48:45 UTC (rev 3634)
@@ -7,7 +7,8 @@
 
 %FAI::ErrorHash = (
 "parted_1" => "Parted produced error. Couldn't remove Partition", 
-"parted_2" => "Could not read disk label."
+"parted_2" => "Parted produced error. Could not read disk label."
+"parted_3" => "Parted produced error. Could not open disk."
 );
 
 #my @stdout = ();
@@ -72,11 +73,15 @@
     return "parted_1";
   }
 
-  if( $command =~ /.*parted.*/ && $stderr_line =~ /.*Error: Unable to open \/dev\/sdd - unrecognised disk label.*/)
+  if( $command =~ /.*parted.*/ && $stderr_line =~ /.*Error: Unable to open .* - unrecognised disk label.*/)
   {
     return "parted_2";
   }
 
+  if( $command =~ /.*parted.*/ && $stderr_line =~ /.*Error: Could not stat device .* - No such file or directory.*/)
+  {
+    return "parted_3";
+  }
 }
 
 

Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-sizes
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-sizes	2006-07-22 23:30:24 UTC (rev 3633)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-sizes	2006-07-22 23:48:45 UTC (rev 3634)
@@ -16,7 +16,31 @@
     }
     $FAI::current_config{$disk}{"partitions"} = {};
 
-    my @parted_print    = split( "\n", `/sbin/parted -s $disk unit TB print` );
+    my @parted_print = ();
+    
+    while(1)
+    {
+      my $error = &FAI::execute_command("/sbin/parted -s $disk unit TB print", \@parted_std_out, 0);
+
+      if ($error eq "parted_2")
+      {
+        $error = &FAI::execute_command("/sbin/parted -s $disk mklabel msdos"); 
+        next;
+      }
+
+      if ($error eq "parted_3")
+      {
+        die $FAI::ErrorHash{"parted_3"};
+      }
+
+      if ($error eq "parted_1")
+      {
+        die $FAI::ErrorHash{"parted_1"};
+      }
+
+      last;
+    }
+
     my $parted_fs_start = 0;
     my $parted_fs_end   = 0;
 




More information about the Fai-commit mailing list