Add support for Linux Containers, fixes #202.

Patch by bug reporter.
This commit is contained in:
Roy Marples 2009-11-04 19:21:24 +00:00
parent 3c8ea5896a
commit 95ee39ab1c
13 changed files with 16 additions and 11 deletions

View File

@ -9,7 +9,7 @@ _IFS="
depend() depend()
{ {
use dev clock modules use dev clock modules
keyword -jail -openvz -prefix -timeout -vserver keyword -jail -openvz -prefix -timeout -vserver -lxc
} }
_abort() { _abort() {

View File

@ -28,7 +28,7 @@ depend()
else else
before * before *
fi fi
keyword -openvz -prefix -uml -vserver -xenu keyword -openvz -prefix -uml -vserver -xenu -lxc
} }
setupopts() setupopts()

View File

@ -8,7 +8,7 @@ depend()
{ {
need fsck need fsck
use lvm modules mtab use lvm modules mtab
keyword -jail -openvz -prefix -vserver keyword -jail -openvz -prefix -vserver -lxc
} }
start() start()

View File

@ -7,7 +7,7 @@ description="Loads a user defined list of kernel modules."
depend() depend()
{ {
use isapnp use isapnp
keyword -openvz -prefix -vserver keyword -openvz -prefix -vserver -lxc
} }
start() start()

View File

@ -7,7 +7,7 @@ description="Re-mount filesytems read-only for a clean reboot."
depend() depend()
{ {
need killprocs savecache need killprocs savecache
keyword -prefix -openvz -vserver keyword -prefix -openvz -vserver -lxc
} }
start() start()

View File

@ -9,7 +9,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
depend() depend()
{ {
need localmount need localmount
keyword -openvz -prefix -vserver keyword -openvz -prefix -vserver -lxc
} }
_setleds() _setleds()

View File

@ -8,7 +8,7 @@ depend()
{ {
use modules devfs use modules devfs
need localmount need localmount
keyword -openvz -prefix -vserver keyword -openvz -prefix -vserver -lxc
} }
start() start()

View File

@ -7,7 +7,7 @@ description="Mount the root fs read/write"
depend() depend()
{ {
need fsck need fsck
keyword -jail -openvz -prefix -vserver keyword -jail -openvz -prefix -vserver -lxc
} }
start() start()

View File

@ -5,7 +5,7 @@
depend() depend()
{ {
need localmount need localmount
keyword -jail -openvz -prefix -vserver keyword -jail -openvz -prefix -vserver -lxc
} }
start() start()

View File

@ -8,7 +8,7 @@ depend()
{ {
before * before *
provide clock provide clock
keyword -openvz -prefix -uml -vserver -xenu keyword -openvz -prefix -uml -vserver -xenu -lxc
} }
# swclock is an OpenRC built in # swclock is an OpenRC built in

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd July 1, 2009 .Dd November 4, 2009
.Dt RUNSCRIPT 8 SMM .Dt RUNSCRIPT 8 SMM
.Os OpenRC .Os OpenRC
.Sh NAME .Sh NAME
@ -143,6 +143,8 @@ When in a jail, exclude this service from any dependencies. The service can
still be run directly. still be run directly.
.It Dv -openvz .It Dv -openvz
Same as -jail, but for OpenVZ systems. Same as -jail, but for OpenVZ systems.
.It Dv -lxc
Same as -jail, but for Linux Resource Containers (LXC).
.It Dv -shutdown .It Dv -shutdown
Don't stop this service when shutting the system down. Don't stop this service when shutting the system down.
This normally quite safe as remaining daemons will be sent a SIGTERM just This normally quite safe as remaining daemons will be sent a SIGTERM just

View File

@ -233,6 +233,8 @@ rc_sys(void)
return RC_SYS_VSERVER; return RC_SYS_VSERVER;
else if (exists("/proc/vz/veinfo") && !exists("/proc/vz/version")) else if (exists("/proc/vz/veinfo") && !exists("/proc/vz/version"))
return RC_SYS_OPENVZ; return RC_SYS_OPENVZ;
else if (file_regex("/proc/self/cgroup", ":/.+$"))
return RC_SYS_LXC;
else if (file_regex("/proc/self/status", else if (file_regex("/proc/self/status",
"envID:[[:space:]]*[1-9]")) "envID:[[:space:]]*[1-9]"))
return RC_SYS_OPENVZ; /* old test */ return RC_SYS_OPENVZ; /* old test */

View File

@ -268,6 +268,7 @@ bool rc_service_daemons_crashed(const char *);
* Some services cannot work in these systems, or we do something else. */ * Some services cannot work in these systems, or we do something else. */
#define RC_SYS_JAIL "JAIL" #define RC_SYS_JAIL "JAIL"
#define RC_SYS_OPENVZ "OPENVZ" #define RC_SYS_OPENVZ "OPENVZ"
#define RC_SYS_LXC "LXC"
#define RC_SYS_PREFIX "PREFIX" #define RC_SYS_PREFIX "PREFIX"
#define RC_SYS_UML "UML" #define RC_SYS_UML "UML"
#define RC_SYS_VSERVER "VSERVER" #define RC_SYS_VSERVER "VSERVER"