/[fai]/people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm
ViewVC logotype

Diff of /people/michael/features/setup_harddisks_2/implementation/lib/sizes.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3588 by michael-guest, Fri Jul 21 23:52:22 2006 UTC revision 3590 by michael-guest, Fri Jul 21 23:55:29 2006 UTC
# Line 6  package FAI; Line 6  package FAI;
6    
7  %FAI::current_config = ();  %FAI::current_config = ();
8    
9  my @parted_print = split( "\n", `/sbin/parted -s /dev/hda unit TB print` );  foreach my $disk ( @FAI::disks )
 my $parted_fs_start = 0;  
 my $parted_fs_end = 0;  
   
 foreach my $line ( @parted_print )  
10  {  {
11    if( $line =~ /^Disk geometry/ )    my @parted_print = split( "\n", `/sbin/parted -s /dev/hda unit TB print` );
12    {    my $parted_fs_start = 0;
13      next;    my $parted_fs_end = 0;
14    }  
15    elsif( $line =~ /^Disk label/ )    foreach my $line ( @parted_print )
   {  
     next;  
   }  
   elsif( $line =~ /^Number/ )  
16    {    {
17      $parted_fs_start = 0;      if( $line =~ /^Disk geometry/ )
     $parted_fs_end = 0;  
     my @chars = split( "", $line );  
     foreach my $char ( @chars )  
18      {      {
19        $parted_fs_end++;        next;
20        if( $char eq "F" )      }
21        {      elsif( $line =~ /^Disk label/ )
22          $parted_fs_start = $parted_fs_end;      {
23        }        next;
24        elsif( $char eq "m" && $parted_fs_start > 0 )      }
25        elsif( $line =~ /^Number/ )
26        {
27          $parted_fs_start = 0;
28          $parted_fs_end = 0;
29          my @chars = split( "", $line );
30          foreach my $char ( @chars )
31        {        {
32          last;          $parted_fs_end++;
33            if( $char eq "F" )
34            {
35              $parted_fs_start = $parted_fs_end;
36            }
37            elsif( $char eq "m" && $parted_fs_start > 0 )
38            {
39              last;
40            }
41        }        }
42          $parted_fs_start--;
43          $parted_fs_end -= $parted_fs_start;
44        }
45        else
46        {
47          $line =~ /^(\d+)/;
48          my $id = $1;
49          $line =~ /^.{$parted_fs_start}(.{$parted_fs_end})/;
50          my $fs = $1;
51          print $id . ": " . $fs . "\n";
52      }      }
     $parted_fs_start--;  
     $parted_fs_end -= $parted_fs_start;  
   }  
   else  
   {  
     $line =~ /^.{$parted_fs_start}(.{$parted_fs_end})/;  
     my $fs = $1;  
     print $fs . "\n";  
   }  
53    
54    
55    
56  }    }
57    
58    
59  @parted_print = split( "\n", `/sbin/parted -s /dev/hda unit B print` );    @parted_print = split( "\n", `/sbin/parted -s /dev/hda unit B print` );
 {  
   foreach my $line ( @parted_print )  
60    {    {
61      if( $line =~ /^(\d+)*\s+(\d+)B\s+(\d+)B\s+(\d+)B/i )      foreach my $line ( @parted_print )
62      {      {
63        printf $1." ".$2." ".$3." ".$4."\n";        if( $line =~ /^(\d+)*\s+(\d+)B\s+(\d+)B\s+(\d+)B/i )
64          {
65            printf $1." ".$2." ".$3." ".$4."\n";
66          }
67      }      }
68    }    }
69  }  }
70    
71    
   
72  foreach my $config ( %FAI::configs )  foreach my $config ( %FAI::configs )
73  {  {
74    

Legend:
Removed from v.3588  
changed lines
  Added in v.3590

  ViewVC Help
Powered by ViewVC 1.1.5