summaryrefslogtreecommitdiffstats
path: root/draklive
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2010-03-30 12:38:21 +0000
committerOlivier Blin <oblin@mandriva.com>2010-03-30 12:38:21 +0000
commitfc897b858da643419aa9cb5b4de5936d0521349b (patch)
treed59877d41e6d827e55fdc4f362509edf316d0977 /draklive
parente022028d90efa93ed9265afa9f92d87df12bd60d (diff)
downloaddrakiso-fc897b858da643419aa9cb5b4de5936d0521349b.tar
drakiso-fc897b858da643419aa9cb5b4de5936d0521349b.tar.gz
drakiso-fc897b858da643419aa9cb5b4de5936d0521349b.tar.bz2
drakiso-fc897b858da643419aa9cb5b4de5936d0521349b.tar.xz
drakiso-fc897b858da643419aa9cb5b4de5936d0521349b.zip
delete existing files on media when recording, unless --keep-files option is used
Diffstat (limited to 'draklive')
-rwxr-xr-xdraklive11
1 files changed, 9 insertions, 2 deletions
diff --git a/draklive b/draklive
index e3a6329..060a9a5 100755
--- a/draklive
+++ b/draklive
@@ -896,6 +896,11 @@ sub record_cdrom_master {
run_('wodim', '-v', 'dev=' . $device, $src);
}
+sub rsync_delete_options {
+ my ($opts) = @_;
+ $opts->{keep_files} ? () : '--delete';
+}
+
sub install_grub_to_image {
my ($live, $media, $img, $opts) = @_;
my $media_boot = $live->get_media_prefix('boot', $opts->{boot});
@@ -1002,7 +1007,7 @@ sub record_usb_master {
output_p($list_file, map { ".$_\n" } list_selected_loopbacks($live));
local $/ = "\r";
my $r = run_foreach(update_progress_rsync($live, $total),
- 'rsync', '-vdP', '--inplace', '--files-from=' . $list_file,
+ 'rsync', '-vdP', '--inplace', '--files-from=' . $list_file, rsync_delete_options($opts),
$loopbacks_source, $live->{mnt} . $media_loopbacks,
);
unlink $list_file;
@@ -1058,7 +1063,7 @@ sub record_harddisk_master {
my $source = $live->get_system_root;
my $total = directory_usage($source);
local $/ = "\r";
- $r = run_foreach(update_progress_rsync($live, $total), 'rsync', '-a', $source . '/', $live->{mnt})
+ $r = run_foreach(update_progress_rsync($live, $total), 'rsync', rsync_delete_options($opts), '-a', $source . '/', $live->{mnt})
or last;
} unless $opts->{boot_only};
@@ -1543,6 +1548,7 @@ my $settings_path = $MDV::Draklive::Config::default_settings_path;
GetOptions(
"help" => sub { Pod::Usage::pod2usage('-verbose' => 1) },
"copy-wizard" => \$live_object->{copy_wizard},
+ "keep-files" => \$opts{keep_files},
"boot-only" => \$opts{boot_only},
"boot-image=s" => sub { $opts{boot} = $_[1]; $opts{boot_only} = 1 },
"all" => sub { $_->{to_run} = 1 foreach grep { member($_->{name}, @all) } @actions },
@@ -1604,6 +1610,7 @@ draklive [options]
--record record live on selected media
--record-onthefly record live by creating master from loopback files
on the fly
+ --keep-files keep existing files on media when recording
--initrd build initrd only
--post-install run post install only (rpms and patches installation)