<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-execute <replaceable>-n name</replaceable>
- <optional>-f config_file</optional>
+ <optional>-f config_file</optional> <optional>-s KEY=VAL
+ </optional>
<replaceable>command</replaceable>
</command>
</cmdsynopsis>
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <option>-s <replaceable>KEY=VAL</replaceable></option>
+ </term>
+ <listitem>
+ <para>
+ Assign value <replaceable>VAL</replaceable> to configuration
+ variable <replaceable>KEY</replaceable>. This overrides any
+ assignment done in <replaceable>config_file</replaceable>.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
lxc_log_define(lxc_execute_ui, lxc_start);
+static struct lxc_list defines;
+
static int my_checker(const struct lxc_arguments* args)
{
if (!args->argc) {
{
switch (c) {
case 'f': args->rcfile = arg; break;
+ case 's': return lxc_config_define_add(&defines, arg);
}
return 0;
}
static const struct option my_longopts[] = {
{"rcfile", required_argument, 0, 'f'},
+ {"define", required_argument, 0, 's'},
LXC_COMMON_OPTIONS
};
and execs COMMAND into this container.\n\
\n\
Options :\n\
- -n, --name=NAME NAME for name of the container\n\
- -f, --rcfile=FILE Load configuration file FILE\n",
+ -n, --name=NAME NAME for name of the container\n\
+ -f, --rcfile=FILE Load configuration file FILE\n\
+ -s, --define KEY=VAL Assign VAL to configuration variable KEY\n",
.options = my_longopts,
.parser = my_parser,
.checker = my_checker,
char *rcfile;
struct lxc_conf *conf;
+ lxc_list_init(&defines);
+
if (lxc_arguments_parse(&my_args, argc, argv))
return -1;
return -1;
}
+ if (lxc_config_define_load(&defines, conf))
+ return -1;
+
return lxc_start(my_args.name, args, conf);
}