From a74f2bf0f95dcf1f034c2e566f366f505e83ba81 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 9 Sep 2009 15:16:42 +0000 Subject: guess partition device number as well --- draklive | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'draklive') diff --git a/draklive b/draklive index 9615b04..0c04004 100755 --- a/draklive +++ b/draklive @@ -728,11 +728,14 @@ sub get_hd_from_file { return $hd; } -sub guess_media_partitions_start { +sub supplement_media_partitions { my ($media, $hd) = @_; - #- try to find partition start by matching actual partition table and partitions list + #- try to find additional partition details (start, device) + #- by matching actual partition table and partitions list my @all_parts = partition_table::get_normal_parts($hd); - $media->{partitions}[$_]{start} = $all_parts[$_]{start} for 0 .. $#all_parts; + foreach my $idx (0 .. $#all_parts) { + $media->{partitions}[$idx]{$_} = $all_parts[$idx]{$_} foreach qw(start device); + } } sub set_part_real_device { @@ -936,7 +939,7 @@ sub record_usb_master { or die "unable to find recording device (missing label? try with --device )\n"; my $hd = get_hd_from_file($media, $main_device); - guess_media_partitions_start($media, $hd); + supplement_media_partitions($media, $hd); my $slash_idx = $media->find_partition_index('/'); my $slash = $media->{partitions}[$slash_idx]; @@ -997,7 +1000,7 @@ sub record_harddisk_master { or die "unable to find recording device (missing label? try with --device )\n"; my $hd = get_hd_from_file($media, $main_device); - guess_media_partitions_start($media, $hd); + supplement_media_partitions($media, $hd); my @partitions = grep { $_->{mntpoint} =~m!^/! } @{$media->{partitions}}; mkdir_p($live->{mnt}); @@ -1172,7 +1175,7 @@ sub record_oem_rescue { or die "unable to find recording device (missing label? try with --device )\n"; my $hd = get_hd_from_file($media, $main_device); - guess_media_partitions_start($media, $hd); + supplement_media_partitions($media, $hd); my $oem_rescue = $media->{partitions}[$oem_rescue_idx]; set_part_real_device($hd, $oem_rescue); @@ -1222,7 +1225,7 @@ sub record_usb_replicator { or die "unable to find recording device (missing label? try with --device )\n"; my $hd = get_hd_from_file($media, $main_device); - guess_media_partitions_start($media, $hd); + supplement_media_partitions($media, $hd); my $slash_idx = $media->find_partition_index('/'); my $slash = $media->{partitions}[$slash_idx]; -- cgit v1.2.1