diff options
-rwxr-xr-x | draklive | 37 |
1 files changed, 21 insertions, 16 deletions
@@ -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}); |