/[fai]/people/michael/features/setup_harddisks_2/implementation/shdd2-sizes
ViewVC logotype

Contents of /people/michael/features/setup_harddisks_2/implementation/shdd2-sizes

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3592 - (show annotations) (download)
Sat Jul 22 00:02:51 2006 UTC (6 years, 10 months ago) by michael-guest
File size: 1705 byte(s)
bugfixes
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 package FAI;
6
7 %FAI::current_config = ();
8
9 foreach my $disk ( @FAI::disks )
10 {
11 if( ! ( $disk =~ m{^/} ) )
12 {
13 $disk = "/dev/" . $disk;
14 }
15
16 my @parted_print = split( "\n", `/sbin/parted -s $disk unit TB print` );
17 my $parted_fs_start = 0;
18 my $parted_fs_end = 0;
19
20 foreach my $line ( @parted_print )
21 {
22 if( $line =~ /^Disk geometry/ )
23 {
24 next;
25 }
26 elsif( $line =~ /^Disk label/ )
27 {
28 next;
29 }
30 elsif( $line =~ /^Number/ )
31 {
32 $parted_fs_start = 0;
33 $parted_fs_end = 0;
34 my @chars = split( "", $line );
35 foreach my $char ( @chars )
36 {
37 $parted_fs_end++;
38 if( $char eq "F" )
39 {
40 $parted_fs_start = $parted_fs_end;
41 }
42 elsif( $char eq "m" && $parted_fs_start > 0 )
43 {
44 last;
45 }
46 }
47 $parted_fs_start--;
48 $parted_fs_end -= $parted_fs_start;
49 }
50 else
51 {
52 $line =~ /^(\d+)/;
53 my $id = $1;
54 $line =~ /^.{$parted_fs_start}(.{$parted_fs_end})/;
55 my $fs = $1;
56 print $id . ": " . $fs . "\n";
57 }
58 }
59
60
61 @parted_print = split( "\n", `/sbin/parted -s $disk unit B print` );
62 {
63 foreach my $line ( @parted_print )
64 {
65 if( $line =~ /^(\d+)*\s+(\d+)B\s+(\d+)B\s+(\d+)B/i )
66 {
67 printf $1." ".$2." ".$3." ".$4."\n";
68 }
69 }
70 }
71
72
73
74 @parted_print = split( "\n", `/sbin/parted -s $disk unit chs print` );
75 {
76 foreach my $line ( @parted_print )
77 {
78
79 if( $line =~ /^\d+\s+(\d+),(\d+),(\d+)\s+(\d+),(\d+),(\d+)/i )
80 {
81 printf $1." ".$2." ".$3." ".$4." ".$5." ".$6."\n";
82 }
83 }
84 }
85 }
86
87
88 foreach my $config ( %FAI::configs )
89 {
90
91
92
93
94 }
95
96 1;
97

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5