diff options
author | Olivier Blin <oblin@mandriva.com> | 2009-08-07 21:31:50 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2009-08-07 21:31:50 +0000 |
commit | 0dfaff54e2d3291735d610c446dd0253f7294094 (patch) | |
tree | b33634b5f29d5bc970b950c18ebfb898ecb44078 | |
parent | f6b66663ad90dbd93ac89f6d6882d393887dc555 (diff) | |
download | draklive-0dfaff54e2d3291735d610c446dd0253f7294094.tar draklive-0dfaff54e2d3291735d610c446dd0253f7294094.tar.gz draklive-0dfaff54e2d3291735d610c446dd0253f7294094.tar.bz2 draklive-0dfaff54e2d3291735d610c446dd0253f7294094.tar.xz draklive-0dfaff54e2d3291735d610c446dd0253f7294094.zip |
adapt to main device being disk instead of partition
-rwxr-xr-x | draklive | 29 |
1 files changed, 20 insertions, 9 deletions
@@ -922,12 +922,20 @@ sub record_usb_master { if (my $label = !$opts->{boot_only} && $opts->{device} && $media->get_media_label) { set_device_label($opts->{device}, $media->get_media_setting('fs'), $label); } - my $device = get_media_device($live, $opts) + my $main_device = get_media_device($live, $opts) or die "unable to find recording device (missing label? try with --device <device>)\n"; + my $hd = get_hd_from_file($media, $main_device); + guess_media_partitions_start($media, $hd); + + my $slash_idx = $media->find_partition_index('/'); + my $slash = $media->{partitions}[$slash_idx]; + set_part_real_device($hd, $slash); + mkdir_p($live->{mnt}); - run_('mount', $device, $live->{mnt}) - or die "unable to mount $device\n"; + run_('mount', $slash->{real_device}, $live->{mnt}) + or die "unable to mount $slash->{real_device}\n"; + rm_rf($live->{mnt} . $media_boot) if -e $live->{mnt} . $media_boot; cp_af($live->get_builddir . $live->{prefix}{build}{boot}, $live->{mnt} . $media_boot); @@ -945,8 +953,9 @@ sub record_usb_master { ); unlink $list_file; if (!$r) { - run_('umount', $live->{mnt}); - maybe_umount_device($device); + run_('umount', $slash->{real_device}); + maybe_umount_device($slash->{real_device}); + devices::del_loop($slash->{real_device}) if -f $hd->{file}; die "unable to copy loopback files\n"; } @@ -955,14 +964,16 @@ sub record_usb_master { my @hidden_files = map { basename($_) } glob_($live->{mnt} . "/.*"), glob_($live->{mnt} . "/autorun.*"); - run_('umount', $live->{mnt}); - maybe_umount_device($device); + run_('umount', $slash->{real_device}); + maybe_umount_device($slash->{real_device}); if ($media->get_media_setting('fs') eq 'vfat') { - MDV::Draklive::Utils::mtools_run_('mattrib', '+h', '-i', $device, '::' . $_) foreach @hidden_files; - MDV::Draklive::Utils::mtools_run_('mattrib', '+r', '+s', '-/', '-i', $device, '::' . $_) + MDV::Draklive::Utils::mtools_run_('mattrib', '+h', '-i', $slash->{real_device}, '::' . $_) foreach @hidden_files; + MDV::Draklive::Utils::mtools_run_('mattrib', '+r', '+s', '-/', '-i', $slash->{real_device}, '::' . $_) foreach $media_boot, $media_loopbacks; } + + devices::del_loop($slash->{real_device}) if -f $hd->{file}; } sub record_harddisk_master { |