btrbk: make target_type optional for "target" section

pull/286/head
Axel Burri 2019-04-24 13:51:52 +02:00
parent 50267f1ca9
commit 6115cbdace
2 changed files with 13 additions and 10 deletions

6
btrbk
View File

@ -3788,9 +3788,11 @@ sub parse_config_line($$$$$)
$cur = $cur->{PARENT} || die; $cur = $cur->{PARENT} || die;
TRACE "config: context changed to: $cur->{CONTEXT}"; TRACE "config: context changed to: $cur->{CONTEXT}";
} }
if($value =~ /^(\S+)\s+(\S+)$/) if($value =~ /^((?<target_type>\S+)\s+)?(?<url>\S+)$/)
{ {
my ($target_type, $url) = ($1, $2); # as of btrbk-0.28.0, target_type is optional and defaults to "send-receive"
my $target_type = $+{target_type} // "send-receive";
my $url = $+{url};
unless(grep(/^\Q$target_type\E$/, @config_target_types)) { unless(grep(/^\Q$target_type\E$/, @config_target_types)) {
ERROR "Unknown target type \"$target_type\" in \"$file\" line $."; ERROR "Unknown target type \"$target_type\" in \"$file\" line $.";
return undef; return undef;

View File

@ -70,15 +70,16 @@ valid UUID, which is not the case for file systems created with
btrfs-progs < 4.16. btrfs-progs < 4.16.
-- --
*target* <type> <target-directory>|<url>:: *target* [send-receive|raw] <target-directory>|<url>::
Target type and directory where the backup subvolumes are to be Target type and directory where the backup subvolumes are to be
created. See the <<_target_types,TARGET TYPES>> section for created. The optional target type defaults to (standard)
supported '<type>'. Multiple 'target' sections are allowed within ``send-receive'', see <<_target_types,TARGET TYPES>> below for
'subvolume' sections. A 'target' section defined in the global details. Multiple 'target' sections are allowed within 'subvolume'
context or in a 'volume' section is propagated (multiplied) to all sections. A 'target' section defined in the global context or in a
underlying 'subvolume' sections, unless a target with the same 'volume' section is propagated (multiplied) to all underlying
declaration already exists (hint: run "btrbk config print" to see 'subvolume' sections, unless a target with the same declaration
the resulting configuration). already exists (hint: run "btrbk config print" to see the
resulting configuration).
If a '<url>' is specified, btrbk actions (shell commands) are executed If a '<url>' is specified, btrbk actions (shell commands) are executed
remotely via ssh, using the <<_ssh_options,SSH Options>> described remotely via ssh, using the <<_ssh_options,SSH Options>> described