- Timestamp:
- Apr 7, 2016, 3:47:44 AM (9 years ago)
- Location:
- branches/3.2
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/MondoRescue/Makefile.PL
r3487 r3553 18 18 EXE_FILES => [ qw( bin/mr-analyze-lvm 19 19 bin/mr-check-lvm 20 bin/mr-disk-list 21 bin/mr-disk-type 20 22 bin/mr-device-mounted 21 23 bin/mr-process-ldd -
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 } -
branches/3.2/mindi/mr-parted2fdisk
r3383 r3553 241 241 $type = mr_disk_type($device); 242 242 # Replacement code only for GPT disks 243 if ((($v == 1) || (($v == 2) && ($maj < 22))) && ($type ne " msdos")) {243 if ((($v == 1) || (($v == 2) && ($maj < 22))) && ($type ne "MBR")) { 244 244 pb_log(1,"This distribution uses an old fdisk, activating replacement code for GPT disk label...\n"); 245 245 my $parted = pb_check_req("parted",0); … … 258 258 } elsif ($i =~ /^n$/) { 259 259 fdisk_list($device,undef,\%start,\%end, 0); 260 if ($type ne " gpt") {260 if ($type ne "GPT") { 261 261 pb_log(1,"Forcing GPT type of disk label\n"); 262 262 pb_log(1,"mklabel gpt\n"); 263 263 pb_system("$parted -s $device mklabel gpt\n") if ($fake == 0); 264 $type = " gpt";264 $type = "GPT"; 265 265 } 266 266 $l = <STDIN>; -
branches/3.2/mondo/src/common/libmondo-devices.c
r3539 r3553 3316 3316 { 3317 3317 char *output = NULL; 3318 char *tmp = NULL;3319 3318 char *command = NULL; 3320 mr_asprintf(command, "mr- parted2fdisk -l %s 2>/dev/null | grep 'EFI GPT'", drive);3321 mr_asprintf( tmp, "%s", call_program_and_get_last_line_of_output(command));3319 mr_asprintf(command, "mr-disk-type %s", drive); 3320 mr_asprintf(output, "%s", call_program_and_get_last_line_of_output(command)); 3322 3321 mr_free(command); 3323 3324 if (strstr(tmp, "GPT") == NULL) {3325 mr_asprintf(output, "%s", "MBR");3326 } else {3327 mr_asprintf(output, "%s", "GPT");3328 }3329 mr_free(tmp);3330 3322 3331 3323 log_msg(0, "Found %s partition table format type on %s", output, drive);
Note:
See TracChangeset
for help on using the changeset viewer.