equal
deleted
inserted
replaced
17 # find the partition tables of all |
17 # find the partition tables of all |
18 # non-removable block devices (this may include |
18 # non-removable block devices (this may include |
19 # LVs (used as disk itself) too) |
19 # LVs (used as disk itself) too) |
20 foreach (glob("/sys/block/*")) { |
20 foreach (glob("/sys/block/*")) { |
21 my $name = basename($_); |
21 my $name = basename($_); |
22 verbose("device $name"); |
22 # verbose("device $name"); |
23 |
23 |
24 if (!-e "$_/device") { |
24 if (!-e "$_/device") { |
25 verbose("skipping (non-dev)\n"); |
25 # verbose("skipping (non-dev)\n"); |
26 next; |
26 next; |
27 } |
27 } |
28 if ((grep { /ATTR{removable}/ } `udevadm info --attribute-walk --name $name`)[0] !~ /==.0./) { |
28 if ((grep { /ATTR{removable}/ } `udevadm info --attribute-walk --name $name`)[0] !~ /==.0./) { |
29 verbose("skipping (removable)\n"); |
29 # verbose("skipping (removable)\n"); |
30 next; |
30 next; |
31 } |
31 } |
32 verbose("\n"); |
32 verbose("\n"); |
|
33 verbose("device $name\n"); |
33 |
34 |
34 die "ERR: /dev/$name does not exist. (should not happen)" |
35 die "ERR: /dev/$name does not exist. (should not happen)" |
35 if !-e "/dev/$name"; |
36 if !-e "/dev/$name"; |
36 |
37 |
37 # now the physical disk -- let's ask for the partition table |
38 # now the physical disk -- let's ask for the partition table |
48 |
49 |
49 push @{$devs->{known}}, "/dev/$name"; |
50 push @{$devs->{known}}, "/dev/$name"; |
50 |
51 |
51 # and let's prepare the volume entries |
52 # and let's prepare the volume entries |
52 foreach (@sfdisk) { |
53 foreach (@sfdisk) { |
53 /^(\S+)\s*:.*Id=\s*(\d+)/ or next; |
54 /^(\S+)\s*:.*Id=\s*([[:xdigit:]]+)/ or next; |
54 $devs->{volume}{$1} = { |
55 $devs->{volume}{$1} = { |
55 origin => "ptable", |
56 origin => "ptable", |
56 ptable_type => $2, |
57 ptable_type => $2, |
57 }; |
58 }; |
58 push @{$devs->{known}}, $1; |
59 push @{$devs->{known}}, $1; |