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

fai-commit at lists.alioth.debian.org fai-commit at lists.alioth.debian.org
Fri Jul 21 23:55:30 UTC 2006


Author: michael-guest
Date: 2006-07-21 23:55:29 +0000 (Fri, 21 Jul 2006)
New Revision: 3590

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


Modified: people/michael/features/setup_harddisks_2/implementation/shdd2-sizes
===================================================================
--- people/michael/features/setup_harddisks_2/implementation/shdd2-sizes	2006-07-21 23:53:25 UTC (rev 3589)
+++ people/michael/features/setup_harddisks_2/implementation/shdd2-sizes	2006-07-21 23:55:29 UTC (rev 3590)
@@ -6,65 +6,69 @@
 
 %FAI::current_config = ();
 
-my @parted_print = split( "\n", `/sbin/parted -s /dev/hda unit TB print` );
-my $parted_fs_start = 0;
-my $parted_fs_end = 0;
+foreach my $disk ( @FAI::disks )
+{
+  my @parted_print = split( "\n", `/sbin/parted -s /dev/hda unit TB print` );
+  my $parted_fs_start = 0;
+  my $parted_fs_end = 0;
 
-foreach my $line ( @parted_print )
-{
-  if( $line =~ /^Disk geometry/ )
+  foreach my $line ( @parted_print )
   {
-    next;
-  }
-  elsif( $line =~ /^Disk label/ )
-  {
-    next;
-  }
-  elsif( $line =~ /^Number/ )
-  {
-    $parted_fs_start = 0;
-    $parted_fs_end = 0;
-    my @chars = split( "", $line );
-    foreach my $char ( @chars )
+    if( $line =~ /^Disk geometry/ )
     {
-      $parted_fs_end++;
-      if( $char eq "F" )
+      next;
+    }
+    elsif( $line =~ /^Disk label/ )
+    {
+      next;
+    }
+    elsif( $line =~ /^Number/ )
+    {
+      $parted_fs_start = 0;
+      $parted_fs_end = 0;
+      my @chars = split( "", $line );
+      foreach my $char ( @chars )
       {
-        $parted_fs_start = $parted_fs_end;
+        $parted_fs_end++;
+        if( $char eq "F" )
+        {
+          $parted_fs_start = $parted_fs_end;
+        }
+        elsif( $char eq "m" && $parted_fs_start > 0 )
+        {
+          last;
+        }
       }
-      elsif( $char eq "m" && $parted_fs_start > 0 )
-      {
-        last;
-      }
+      $parted_fs_start--;
+      $parted_fs_end -= $parted_fs_start;
     }
-    $parted_fs_start--;
-    $parted_fs_end -= $parted_fs_start;
-  }
-  else
-  {
-    $line =~ /^.{$parted_fs_start}(.{$parted_fs_end})/;
-    my $fs = $1;
-    print $fs . "\n";
-  }
+    else
+    {
+      $line =~ /^(\d+)/;
+      my $id = $1;
+      $line =~ /^.{$parted_fs_start}(.{$parted_fs_end})/;
+      my $fs = $1;
+      print $id . ": " . $fs . "\n";
+    }
 
 
-  
-}
+    
+  }
 
 
- at parted_print = split( "\n", `/sbin/parted -s /dev/hda unit B print` );
-{
-  foreach my $line ( @parted_print )
+  @parted_print = split( "\n", `/sbin/parted -s /dev/hda unit B print` );
   {
-    if( $line =~ /^(\d+)*\s+(\d+)B\s+(\d+)B\s+(\d+)B/i )
+    foreach my $line ( @parted_print )
     {
-      printf $1." ".$2." ".$3." ".$4."\n";
+      if( $line =~ /^(\d+)*\s+(\d+)B\s+(\d+)B\s+(\d+)B/i )
+      {
+        printf $1." ".$2." ".$3." ".$4."\n";
+      }
     }
   }
 }
 
 
-
 foreach my $config ( %FAI::configs )
 {
     




More information about the Fai-commit mailing list