Commit 9d225fad authored by Adrian Reber's avatar Adrian Reber Committed by Andrei Vagin

config: add support for CRIU_CONFIG_FILE

With this it is possible to point the environment variable
CRIU_CONFIG_FILE to a CRIU configuration file.

The order the configuration files are evaluated now is:

 1. global (/etc/criu/default.conf)
 2. user ($HOME/.criu/default.conf)
 3. CRIU_CONFIG_FILE
 4. --config FILENAME
 5. CLI
Signed-off-by: 's avatarAdrian Reber <areber@redhat.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent eb6229af
...@@ -160,6 +160,7 @@ static int next_config(char **argv, char ***_argv, bool no_default_config, ...@@ -160,6 +160,7 @@ static int next_config(char **argv, char ***_argv, bool no_default_config,
{ {
char local_filepath[PATH_MAX + 1]; char local_filepath[PATH_MAX + 1];
char *home_dir = NULL; char *home_dir = NULL;
char *cfg_from_env = NULL;
if (state > PARSING_ARGV) if (state > PARSING_ARGV)
return 0; return 0;
...@@ -183,6 +184,10 @@ static int next_config(char **argv, char ***_argv, bool no_default_config, ...@@ -183,6 +184,10 @@ static int next_config(char **argv, char ***_argv, bool no_default_config,
} }
break; break;
case PARSING_ENV_CONF: case PARSING_ENV_CONF:
cfg_from_env = getenv("CRIU_CONFIG_FILE");
if (!cfg_from_env)
break;
*_argv = parse_config(cfg_from_env);
break; break;
case PARSING_CMDLINE_CONF: case PARSING_CMDLINE_CONF:
if (!cfg_file) if (!cfg_file)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment