From b77abb3eff0bf2936396c1b65b6f048123cbb5a4 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sun, 26 Mar 2023 15:34:02 +0200 Subject: [PATCH] btrbk: abort if cmdline specified config not found --- btrbk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/btrbk b/btrbk index 719066b..b7baa0e 100755 --- a/btrbk +++ b/btrbk @@ -4321,7 +4321,7 @@ sub _config_collect_values sub init_config(@) { - my %defaults = ( CONTEXT => "meta", @_ ); + my %defaults = ( CONTEXT => "meta", SRC_FILE => "DEFAULTS", @_ ); # set defaults foreach (keys %config_options) { next if $config_options{$_}->{deprecated}; # don't pollute hash with deprecated options @@ -5584,8 +5584,9 @@ MAIN: $config = parse_config($config_file); exit 2 unless($config); } - elsif($fallback_default_config) { - INFO "Configuration file not found, falling back to defaults"; + elsif($fallback_default_config && !$config_cmdline) { + INFO "Configuration file not found: " . join(', ', @config_src); + INFO "Using default configuration"; $config = init_config(); } else {