Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
20117280
Commit
20117280
authored
Jan 14, 2010
by
Cedric Le Goater
Committed by
Daniel Lezcano
Jan 14, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --define to execute
Signed-off-by:
Cedric Le Goater
<
clg@fr.ibm.com
>
Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
62e46035
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
lxc-execute.sgml.in
doc/lxc-execute.sgml.in
+14
-1
lxc_execute.c
src/lxc/lxc_execute.c
+12
-2
No files found.
doc/lxc-execute.sgml.in
View file @
20117280
...
@@ -49,7 +49,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
...
@@ -49,7 +49,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<refsynopsisdiv>
<refsynopsisdiv>
<cmdsynopsis>
<cmdsynopsis>
<command>lxc-execute <replaceable>-n name</replaceable>
<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>
<replaceable>command</replaceable>
</command>
</command>
</cmdsynopsis>
</cmdsynopsis>
...
@@ -90,6 +91,18 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
...
@@ -90,6 +91,18 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</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>
</variablelist>
...
...
src/lxc/lxc_execute.c
View file @
20117280
...
@@ -41,6 +41,8 @@
...
@@ -41,6 +41,8 @@
lxc_log_define
(
lxc_execute_ui
,
lxc_start
);
lxc_log_define
(
lxc_execute_ui
,
lxc_start
);
static
struct
lxc_list
defines
;
static
int
my_checker
(
const
struct
lxc_arguments
*
args
)
static
int
my_checker
(
const
struct
lxc_arguments
*
args
)
{
{
if
(
!
args
->
argc
)
{
if
(
!
args
->
argc
)
{
...
@@ -55,12 +57,14 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
...
@@ -55,12 +57,14 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
{
{
switch
(
c
)
{
switch
(
c
)
{
case
'f'
:
args
->
rcfile
=
arg
;
break
;
case
'f'
:
args
->
rcfile
=
arg
;
break
;
case
's'
:
return
lxc_config_define_add
(
&
defines
,
arg
);
}
}
return
0
;
return
0
;
}
}
static
const
struct
option
my_longopts
[]
=
{
static
const
struct
option
my_longopts
[]
=
{
{
"rcfile"
,
required_argument
,
0
,
'f'
},
{
"rcfile"
,
required_argument
,
0
,
'f'
},
{
"define"
,
required_argument
,
0
,
's'
},
LXC_COMMON_OPTIONS
LXC_COMMON_OPTIONS
};
};
...
@@ -73,8 +77,9 @@ lxc-execute creates a container with the identifier NAME\n\
...
@@ -73,8 +77,9 @@ lxc-execute creates a container with the identifier NAME\n\
and execs COMMAND into this container.
\n
\
and execs COMMAND into this container.
\n
\
\n
\
\n
\
Options :
\n
\
Options :
\n
\
-n, --name=NAME NAME for name of the container
\n
\
-n, --name=NAME NAME for name of the container
\n
\
-f, --rcfile=FILE Load configuration file FILE
\n
"
,
-f, --rcfile=FILE Load configuration file FILE
\n
\
-s, --define KEY=VAL Assign VAL to configuration variable KEY
\n
"
,
.
options
=
my_longopts
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
.
parser
=
my_parser
,
.
checker
=
my_checker
,
.
checker
=
my_checker
,
...
@@ -86,6 +91,8 @@ int main(int argc, char *argv[])
...
@@ -86,6 +91,8 @@ int main(int argc, char *argv[])
char
*
rcfile
;
char
*
rcfile
;
struct
lxc_conf
*
conf
;
struct
lxc_conf
*
conf
;
lxc_list_init
(
&
defines
);
if
(
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
))
if
(
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
))
return
-
1
;
return
-
1
;
...
@@ -124,6 +131,9 @@ int main(int argc, char *argv[])
...
@@ -124,6 +131,9 @@ int main(int argc, char *argv[])
return
-
1
;
return
-
1
;
}
}
if
(
lxc_config_define_load
(
&
defines
,
conf
))
return
-
1
;
return
lxc_start
(
my_args
.
name
,
args
,
conf
);
return
lxc_start
(
my_args
.
name
,
args
,
conf
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment