From 6f1145c2796adb1f97b1b70d9df5505f860e3e37 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Tue, 7 Jun 2022 00:31:58 +0200 Subject: [PATCH] btrbk: add archive related summary Note that "no target action" for archive is replaced by "", for consistency with action run: [-] /path/to/target/snapshot_basename.* is now displayed as: --- btrbk | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/btrbk b/btrbk index 987d1ff..09c11dc 100755 --- a/btrbk +++ b/btrbk @@ -4919,12 +4919,12 @@ sub print_header(@) } if($args{options} && (scalar @{$args{options}})) { print "\nOptions:\n "; - print join("\n ", @{$args{options}}); + print join("\n ", grep(defined, @{$args{options}})); print "\n"; } if($args{legend}) { print "\nLegend:\n "; - print join("\n ", @{$args{legend}}); + print join("\n ", grep(defined, @{$args{legend}})); print "\n"; } print "--------------------------------------------------------------------------------\n"; @@ -7054,7 +7054,14 @@ MAIN: } if(@subvol_out) { - push @out, "$svol->{PRINT}", @subvol_out, ""; + if($action_archive) { + my $snaproot = vinfo_snapshot_root($svol); + my $snapshot_basename = config_key($svol, "snapshot_name"); + push @out, "$snaproot->{PRINT}/${snapshot_basename}.*"; + } else { + push @out, "$svol->{PRINT}"; + } + push @out, @subvol_out, ""; } } } @@ -7065,14 +7072,14 @@ MAIN: push @cmdline_options, "$preserve_snapshots: Preserved all snapshots" if($preserve_snapshots); push @cmdline_options, "$preserve_backups: Preserved all backups" if($preserve_backups); - print_header(title => "Backup Summary", + print_header(title => $action_archive ? "Archive Summary" : "Backup Summary", config => $config, time => $start_time, options => \@cmdline_options, legend => [ - "=== up-to-date subvolume (source snapshot)", - "++. created directory", - "+++ created subvolume (source snapshot)", + $action_archive && "++. created directory", + $action_run && "=== up-to-date subvolume (source snapshot)", + $action_run && "+++ created subvolume (source snapshot)", "--- deleted subvolume", "*** received subvolume (non-incremental)", ">>> received subvolume (incremental)",