mirror of https://github.com/digint/btrbk
btrbk: added consistent print header for all actions
parent
7f7b6477d2
commit
eba0028fe4
127
btrbk
127
btrbk
|
@ -1317,6 +1317,35 @@ sub schedule(@)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub print_header(@) {
|
||||||
|
my %args = @_;
|
||||||
|
my $config = $args{config};
|
||||||
|
|
||||||
|
print "--------------------------------------------------------------------------------\n";
|
||||||
|
print "$args{title} ($version_info)\n\n";
|
||||||
|
if($args{time}) {
|
||||||
|
print " Date: " . localtime($args{time}) . "\n";
|
||||||
|
}
|
||||||
|
if($config) {
|
||||||
|
print " Config: $config->{SRC_FILE}\n";
|
||||||
|
if($config->{RUN_FILTER}) {
|
||||||
|
print " Filter: ";
|
||||||
|
print join("\n ", map { $_->{PRINT} } @{$config->{RUN_FILTER}});
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($args{info}) {
|
||||||
|
print "\n" . join("\n", grep(defined, @{$args{info}})) . "\n";
|
||||||
|
}
|
||||||
|
if($args{legend}) {
|
||||||
|
print "\nLegend:\n ";
|
||||||
|
print join("\n ", @{$args{legend}});
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
print "--------------------------------------------------------------------------------\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MAIN:
|
MAIN:
|
||||||
{
|
{
|
||||||
# set PATH instead of using absolute "/sbin/btrfs" (for now), as
|
# set PATH instead of using absolute "/sbin/btrfs" (for now), as
|
||||||
|
@ -1464,19 +1493,28 @@ MAIN:
|
||||||
my $ret = btrfs_subvolume_find_new($target_vol, $lastgen);
|
my $ret = btrfs_subvolume_find_new($target_vol, $lastgen);
|
||||||
exit 1 unless(ref($ret));
|
exit 1 unless(ref($ret));
|
||||||
|
|
||||||
print "--------------------------------------------------------------------------------\n";
|
print_header(title => "Subvolume Diff",
|
||||||
print "Showing changed files for subvolume:\n $target_vol->{PRINT} (gen=$target_vol->{gen})\n";
|
time => $start_time,
|
||||||
print "\nStarting at creation generation of subvolume:\n $src_vol->{PRINT} (cgen=$src_vol->{cgen})\n";
|
info => [
|
||||||
print "\nThis will show all files modified within generation range: [$lastgen..$target_vol->{gen}]\n";
|
"Showing changed files for subvolume:",
|
||||||
print "Newest file generation (transid marker) was: $ret->{transid_marker}\n";
|
" $target_vol->{PRINT} (gen=$target_vol->{gen})",
|
||||||
print "Parse errors: $ret->{parse_errors}\n" if($ret->{parse_errors});
|
"",
|
||||||
print "\nLegend: <flags> <count> <size> <filename>\n";
|
"Starting at creation generation of subvolume:",
|
||||||
print " +.. file accessed at offset 0 (at least once)\n";
|
" $src_vol->{PRINT} (cgen=$src_vol->{cgen})",
|
||||||
print " .c. flags COMPRESS or COMPRESS|INLINE set (at least once)\n";
|
"",
|
||||||
print " ..i flags INLINE or COMPRESS|INLINE set (at least once)\n";
|
"This will show all files modified within generation range: [$lastgen..$target_vol->{gen}]",
|
||||||
print " <count> file was modified in <count> generations\n";
|
"Newest file generation (transid marker) was: $ret->{transid_marker}",
|
||||||
print " <size> file was modified for a total of <size> bytes\n";
|
($ret->{parse_errors} ? "Parse errors: $ret->{parse_errors}" : undef),
|
||||||
print "--------------------------------------------------------------------------------\n";
|
],
|
||||||
|
legend => [
|
||||||
|
"+.. file accessed at offset 0 (at least once)",
|
||||||
|
".c. flags COMPRESS or COMPRESS|INLINE set (at least once)",
|
||||||
|
"..i flags INLINE or COMPRESS|INLINE set (at least once)",
|
||||||
|
"<count> file was modified in <count> generations",
|
||||||
|
"<size> file was modified for a total of <size> bytes",
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
my $files = $ret->{files};
|
my $files = $ret->{files};
|
||||||
|
|
||||||
# calculate the character offsets
|
# calculate the character offsets
|
||||||
|
@ -1724,12 +1762,15 @@ MAIN:
|
||||||
my $lines = [];
|
my $lines = [];
|
||||||
_origin_tree("", $vol->{uuid}, $lines);
|
_origin_tree("", $vol->{uuid}, $lines);
|
||||||
|
|
||||||
print "--------------------------------------------------------------------------------\n";
|
print_header(title => "Origin Tree",
|
||||||
print "Origin Tree\n\n";
|
config => $config,
|
||||||
print " ^-- : received from subvolume\n";
|
time => $start_time,
|
||||||
print " newline : parent subvolume\n";
|
legend => [
|
||||||
print " orphaned: subvolume uuid could not be resolved (probably deleted)\n";
|
"^-- : received from subvolume",
|
||||||
print "--------------------------------------------------------------------------------\n";
|
"newline : parent subvolume",
|
||||||
|
"orphaned: subvolume uuid could not be resolved (probably deleted)",
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
my $len = 0;
|
my $len = 0;
|
||||||
if($dump_uuid) {
|
if($dump_uuid) {
|
||||||
|
@ -1786,16 +1827,16 @@ MAIN:
|
||||||
}
|
}
|
||||||
push @out, "";
|
push @out, "";
|
||||||
}
|
}
|
||||||
print "--------------------------------------------------------------------------------\n";
|
|
||||||
print "Backup Tree\n\n";
|
|
||||||
print " Date: " . localtime($start_time) . "\n";
|
|
||||||
print " Config: $config->{SRC_FILE}\n";
|
|
||||||
print "\nLegend:\n";
|
|
||||||
print " ^-- snapshot\n";
|
|
||||||
print " ^== snapshot (up-to-date)\n";
|
|
||||||
print " >>> received subvolume (backup)\n";
|
|
||||||
print "--------------------------------------------------------------------------------\n";
|
|
||||||
|
|
||||||
|
print_header(title => "Backup Tree",
|
||||||
|
config => $config,
|
||||||
|
time => $start_time,
|
||||||
|
legend => [
|
||||||
|
"^-- snapshot",
|
||||||
|
"^== snapshot (up-to-date)",
|
||||||
|
">>> received subvolume (backup)",
|
||||||
|
]
|
||||||
|
);
|
||||||
print join("\n", @out);
|
print join("\n", @out);
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
@ -2193,24 +2234,18 @@ MAIN:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "--------------------------------------------------------------------------------\n";
|
print_header(title => "Backup Summary",
|
||||||
print "Backup Summary ($version_info)\n\n";
|
config => $config,
|
||||||
print " Date: " . localtime($start_time) . "\n";
|
time => $start_time,
|
||||||
print " Config: $config->{SRC_FILE}\n";
|
legend => [
|
||||||
if($config->{RUN_FILTER}) {
|
"=== up-to-date subvolume (source snapshot)",
|
||||||
print " Filter: ";
|
"+++ created subvolume (source snapshot)",
|
||||||
print join("\n ", map { $_->{PRINT} } @{$config->{RUN_FILTER}});
|
"--- deleted subvolume",
|
||||||
print "\n";
|
"*** received subvolume (non-incremental)",
|
||||||
}
|
">>> received subvolume (incremental)",
|
||||||
print "\nLegend:\n";
|
# "%>> received subvolume (incremental, resume_missing)",
|
||||||
print " === up-to-date subvolume (source snapshot)\n";
|
],
|
||||||
print " +++ created subvolume (source snapshot)\n";
|
);
|
||||||
print " --- deleted subvolume\n";
|
|
||||||
print " *** received subvolume (non-incremental)\n";
|
|
||||||
print " >>> received subvolume (incremental)\n";
|
|
||||||
# print " %>> received subvolume (incremental, resume_missing)\n";
|
|
||||||
print "--------------------------------------------------------------------------------\n";
|
|
||||||
|
|
||||||
print join("\n", @out);
|
print join("\n", @out);
|
||||||
|
|
||||||
if($resume_only) {
|
if($resume_only) {
|
||||||
|
|
Loading…
Reference in New Issue