Changeset 3553 in MondoRescue for branches/3.2/MondoRescue/lib/MondoRescue/Disk.pm
- Timestamp:
- Apr 7, 2016, 3:47:44 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/MondoRescue/lib/MondoRescue/Disk.pm
r3447 r3553 23 23 24 24 our @ISA = qw(Exporter); 25 our @EXPORT = qw(mr_disk_ type mr_device_mounted);25 our @EXPORT = qw(mr_disk_list mr_disk_type mr_device_mounted); 26 26 27 27 =pod … … 39 39 =over 4 40 40 41 =item B<mr_disk_list> 42 43 This function uses fdisk to determine the list of all the disks on the system 44 It returns an array of strings giving all the devices 45 46 =cut 47 48 sub mr_disk_list { 49 50 my $fdisk = pb_check_req("fdisk",0); 51 my @disks; 52 53 open(FDISK, "LANG=C $fdisk -l 2>/dev/null |") || die "Unable to read from $fdisk"; 54 while (<FDISK>) { 55 chomp($_); 56 my $i = $_; 57 if ($i =~ /^Disk \//) { 58 pb_log(2,"Found disk line: $i\n"); 59 $i =~ s|^Disk /([A-z0-9/_-]+):.*|/$1|; 60 pb_log(2,"Pushing $i\n"); 61 push @disks,$i; 62 } 63 } 64 close(FDISK); 65 pb_log(2,"Found the following disks: @disks\n"); 66 return (@disks); 67 } 68 41 69 =item B<mr_disk_type> 42 70 … … 50 78 my $device = shift; 51 79 # MBR by default 52 my $type = " msdos";80 my $type = "MBR"; 53 81 54 82 my $fdisk = pb_check_req("fdisk",0); 55 83 56 open(FDISK, " $fdisk -l $device 2>/dev/null |") || die "Unable to read from $fdisk";84 open(FDISK, "LANG=C $fdisk -l $device 2>/dev/null |") || die "Unable to read from $fdisk"; 57 85 while (<FDISK>) { 58 if (($_ =~ /EFI GPT/) || ($_ =~ / GPT /) ) {59 $type= " gpt";86 if (($_ =~ /EFI GPT/) || ($_ =~ / GPT /) || ($_ =~ /Disk[\s]*label type: gpt/)) { 87 $type= "GPT"; 60 88 last; 61 89 }
Note:
See TracChangeset
for help on using the changeset viewer.