From 206e706d85032bdeae0df1d6418c58f8c4d2406b Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Tue, 30 Apr 2019 13:38:47 +0200 Subject: [PATCH] btrbk: allow overriding options with context restrictions This allows commands like: btrbk run mysubvol --override=snapshot_name=mysubvol-oneshot --- btrbk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/btrbk b/btrbk index 06da744..067e69e 100755 --- a/btrbk +++ b/btrbk @@ -3599,7 +3599,7 @@ sub append_config_option($$$$;@) return undef; } - if($opt->{context} && !grep(/^$context$/, @{$opt->{context}})) { + if($opt->{context} && !grep(/^$context$/, @{$opt->{context}}) && ($context ne "OVERRIDE")) { ERROR "Option \"$key\" is only allowed in " . join(" or ", map("\"$_\"", @{$opt->{context}})) . " context $error_statement"; return undef; } @@ -4963,7 +4963,7 @@ MAIN: my $key = $1; my $value = $2; DEBUG "config_override: \"$key=$value\""; - unless(append_config_option(\%config_override, $key, $value, "root", error_statement => "in option \"--override\"")) { + unless(append_config_option(\%config_override, $key, $value, "OVERRIDE", error_statement => "in option \"--override\"")) { HELP_MESSAGE(0); exit 2; }