diff options
author | Daniel Lezcano <daniel.lezcano@free.fr> | 2011-01-28 00:14:51 +0100 |
---|---|---|
committer | Daniel Lezcano <dlezcano@fr.ibm.com> | 2011-01-28 00:14:51 +0100 |
commit | 3244e75040a98d2854144ebc169a5a61ddbe0a26 (patch) | |
tree | be9d0d09aaca4540b4ae108eeaff0c91aac9df7e | |
parent | suppress udev log output (diff) | |
download | lxc-3244e75040a98d2854144ebc169a5a61ddbe0a26.tar.gz lxc-3244e75040a98d2854144ebc169a5a61ddbe0a26.tar.bz2 lxc-3244e75040a98d2854144ebc169a5a61ddbe0a26.zip |
export env variable in lxc_start
Let's export the 'container' variable and let init receive it
as a kernel command line option.
In the upstart init scripts, we can distinguish if we are in a
container context or not.
===============================================================================
# /dev/console - getty
#
# This service maintains a getty on /dev/console from the point the
# system is started until it is shut down again.
# It only runs in lxc containers.
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
env container
pre-start script
[ "x$container" != "xlxc" ] && { stop; exit 0; }
exit 0;
end script
respawn
exec /sbin/getty -8 38400 /dev/console
===============================================================================
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
-rw-r--r-- | src/lxc/lxc_start.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c index 661764a..4f3d964 100644 --- a/src/lxc/lxc_start.c +++ b/src/lxc/lxc_start.c @@ -117,6 +117,11 @@ int main(int argc, char *argv[]) my_args.progname, my_args.quiet)) return err; + if (putenv("container=lxc")) { + SYSERROR("failed to set environment variable"); + return err; + } + /* rcfile is specified in the cli option */ if (my_args.rcfile) rcfile = (char *)my_args.rcfile; |