From 6115cbdace590e8ee61ebf15da51b8074b347494 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Wed, 24 Apr 2019 13:51:52 +0200 Subject: [PATCH] btrbk: make target_type optional for "target" section --- btrbk | 6 ++++-- doc/btrbk.conf.5.asciidoc | 17 +++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/btrbk b/btrbk index c636778..67697f3 100755 --- a/btrbk +++ b/btrbk @@ -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 =~ /^((?\S+)\s+)?(?\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; diff --git a/doc/btrbk.conf.5.asciidoc b/doc/btrbk.conf.5.asciidoc index 35779a8..dbb4d9a 100644 --- a/doc/btrbk.conf.5.asciidoc +++ b/doc/btrbk.conf.5.asciidoc @@ -70,15 +70,16 @@ valid UUID, which is not the case for file systems created with btrfs-progs < 4.16. -- -*target* |:: +*target* [send-receive|raw] |:: Target type and directory where the backup subvolumes are to be - created. See the <<_target_types,TARGET TYPES>> section for - supported ''. 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 '' is specified, btrbk actions (shell commands) are executed remotely via ssh, using the <<_ssh_options,SSH Options>> described