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()
{
use dev clock modules
keyword -jail -openvz -prefix -timeout -vserver
keyword -jail -openvz -prefix -timeout -vserver -lxc
}
_abort() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ depend()
{
before *
provide clock
keyword -openvz -prefix -uml -vserver -xenu
keyword -openvz -prefix -uml -vserver -xenu -lxc
}
# 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
.\" SUCH DAMAGE.
.\"
.Dd July 1, 2009
.Dd November 4, 2009
.Dt RUNSCRIPT 8 SMM
.Os OpenRC
.Sh NAME
@ -143,6 +143,8 @@ When in a jail, exclude this service from any dependencies. The service can
still be run directly.
.It Dv -openvz
Same as -jail, but for OpenVZ systems.
.It Dv -lxc
Same as -jail, but for Linux Resource Containers (LXC).
.It Dv -shutdown
Don't stop this service when shutting the system down.
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;
else if (exists("/proc/vz/veinfo") && !exists("/proc/vz/version"))
return RC_SYS_OPENVZ;
else if (file_regex("/proc/self/cgroup", ":/.+$"))
return RC_SYS_LXC;
else if (file_regex("/proc/self/status",
"envID:[[:space:]]*[1-9]"))
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. */
#define RC_SYS_JAIL "JAIL"
#define RC_SYS_OPENVZ "OPENVZ"
#define RC_SYS_LXC "LXC"
#define RC_SYS_PREFIX "PREFIX"
#define RC_SYS_UML "UML"
#define RC_SYS_VSERVER "VSERVER"