btrbk: allow trailing comments in btrbk.conf

pull/135/head
Axel Burri 2017-03-18 16:34:53 +01:00
parent 358a2b1169
commit d31ffb8cb0
3 changed files with 6 additions and 5 deletions

View File

@ -9,6 +9,7 @@ btrbk-current
* Add "backend btrfs-progs-sudo" configuration option (close #115).
* Show aggregate "size" and "used" for "usage" action (close #119).
* Add "raw_target_split" configuration option (close #125).
* Allow trailing comments in btrbk.conf (close #129).
* Bugfix: rate limiting must be done after compression (close #134).
* raw_target_encrypt: Always set "gpg --no-random-seed-file":
prevents creation of "~/.gnupg/random_seed" with slight perfomance

4
btrbk
View File

@ -2902,14 +2902,14 @@ sub parse_config(@)
open(FILE, '<', $file) or die $!;
while (<FILE>) {
chomp;
next if /^\s*#/; # ignore comments
s/#.*//; # remove comments
s/\s*$//; # remove trailing whitespace
next if /^\s*$/; # ignore empty lines
TRACE "config: parsing line $. with context=$cur->{CONTEXT}: \"$_\"";
if(/^(\s*)([a-zA-Z_]+)\s+(.*)$/)
{
# NOTE: we do not perform checks on indentation!
my ($indent, $key, $value) = (length($1), lc($2), $3);
$value =~ s/\s*$//;
$cur = parse_config_line($file, $root, $cur, $key, $value);
unless(defined($cur)) {
# error, bail out

View File

@ -19,6 +19,9 @@ defined either globally or within a section.
The options specified always apply to the last section encountered,
superseding the values set in upper-level sections. This means that
global options must be set before any sections are defined.
.PP
Blank lines are ignored. A hash character (#) starts a comment
extending until end of line.
.SH SECTIONS
.PP
\fBvolume\fR <volume\-directory>|<url>
@ -305,9 +308,6 @@ For convenience, it is also possible to set \fIbackend_local\fR or
local or remote sources/targets (e.g. "backend_remote
btrfs-progs-btrbk").
.RE
.PP
Lines that contain a hash character (#) in the first column are
treated as comments.
.SH RETENTION POLICY
btrbk uses separate retention policies for snapshots and backups,
which are defined by the \fIsnapshot_preserve_min\fR,