From 929940d535f8eda0e29d2b014d2292499643dea3 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 29 Jun 2009 13:27:37 +0000 Subject: extract record_rescue_files --- draklive | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/draklive b/draklive index 20e1fdf..d01bfad 100755 --- a/draklive +++ b/draklive @@ -1055,6 +1055,26 @@ sub get_rescue_files { ); } +sub record_rescue_files { + my ($mnt, $device, $rescue_files) = @_; + my $failed; + foreach (group_by2(@$rescue_files)) { + my ($src, $dest) = @$_; + $dest = $mnt . $dest; + mkdir_p($dest =~ m!/$! ? $dest : dirname($dest)); + if (!run_('rsync', '-vdP', '--inplace', $src, $dest)) { + $failed = 1; + last; + } + } + + if ($failed) { + run_('umount', $mnt); + maybe_umount_device($device); + die "unable to copy rescue files\n"; + } +} + sub get_disk_replicator_path { my ($live) = @_; $live->get_builddir . $live->{prefix}{build}{dist} . '/' . $live->get_name . '.rest.img'; @@ -1089,22 +1109,7 @@ sub record_usb_replicator { rm_rf($live->{mnt} . $media_boot) if -e $live->{mnt} . $media_boot; install_usb_bootloader($live, $media, $opts); - my $failed; - foreach (group_by2(get_disk_replicator_files($live))) { - my ($src, $dest) = @$_; - $dest = $live->{mnt} . $dest; - mkdir_p($dest =~ m!/$! ? $dest : dirname($dest)); - if (!run_('rsync', '-vdP', '--inplace', $src, $dest)) { - $failed = 1; - last; - } - } - if ($failed) { - run_('umount', $live->{mnt}); - maybe_umount_device($device); - die "unable to copy replicator files\n"; - } - + record_rescue_files($live->{mnt}, $device, [ get_disk_replicator_files($live) ]); output_p($live->{mnt} . "/images/list", "EN,English," . basename(get_disk_image_path($live)) . ",on\n"); run_('umount', $live->{mnt}); -- cgit v1.2.1