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;
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)) {
ERROR "Unknown target type \"$target_type\" in \"$file\" line $.";
return undef;

View File

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