From 7779db68f1c5603a43759594ae6d0bc4efcdd2a0 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 c34302c..85b56a5 100755 --- a/btrbk +++ b/btrbk @@ -4319,7 +4319,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 @@ -5582,8 +5582,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 {