mirror of
git://git.yoctoproject.org/meta-virtualization.git
synced 2025-07-19 12:50:22 +02:00
lxc: fix systemd init issues
To generate a proper systemd.service file we should use lxc's builtin configuration option for the initscript type. To support both sysvinit and systemd, we trigger off the DISTRO var and enable the proper init system accordingly. When properly configured, lxc will create helper scripts and install the service file, so we can delete the explicit copy of the service file and let the default rules trigger and install what is needed. The helper files installed by lxc require a lsb function that is not commonly available in the 'functions' library: "action". To ensure that the helper scripts operate, we create a local action() routine with the expected semantics. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
This commit is contained in:
parent
19ca5c408a
commit
1365af123e
|
@ -0,0 +1,38 @@
|
|||
From aada9da49caca9e4a25764df2d2a2c11d9d95dbb Mon Sep 17 00:00:00 2001
|
||||
From: Bruce Ashfield <bruce.ashfield@windriver.com>
|
||||
Date: Fri, 10 Apr 2015 10:55:49 -0400
|
||||
Subject: [PATCH] lxc-helper: create local action() function
|
||||
|
||||
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
|
||||
---
|
||||
config/init/sysvinit/lxc.in | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/config/init/sysvinit/lxc.in b/config/init/sysvinit/lxc.in
|
||||
index 19c102e74c86..9f96a4f7496f 100644
|
||||
--- a/config/init/sysvinit/lxc.in
|
||||
+++ b/config/init/sysvinit/lxc.in
|
||||
@@ -52,6 +52,20 @@ test ! -r "$sysconfdir"/sysconfig/lxc ||
|
||||
# Check for needed utility program
|
||||
[ -x "$bindir"/lxc-autostart ] || exit 1
|
||||
|
||||
+action()
|
||||
+{
|
||||
+ local STRING rc
|
||||
+
|
||||
+ STRING=$1
|
||||
+ echo -n "$STRING "
|
||||
+
|
||||
+ shift
|
||||
+ "$@" && success $"$STRING" || failure $"$STRING"
|
||||
+ rc=$?
|
||||
+
|
||||
+ return $rc
|
||||
+}
|
||||
+
|
||||
# If libvirtd is providing the bridge, it might not be
|
||||
# immediately available, so wait a bit for it before starting
|
||||
# up the containers or else any that use the bridge will fail
|
||||
--
|
||||
2.1.0
|
||||
|
|
@ -27,6 +27,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
|
|||
file://run-ptest \
|
||||
file://automake-ensure-VPATH-builds-correctly.patch \
|
||||
file://add-lxc.rebootsignal.patch \
|
||||
file://lxc-helper-create-local-action-function.patch \
|
||||
file://document-lxc.rebootsignal.patch \
|
||||
file://lxc-busybox-use-lxc.rebootsignal-SIGTERM.patch \
|
||||
file://ppc-add-seccomp-support-for-lxc.patch \
|
||||
|
@ -42,6 +43,8 @@ S = "${WORKDIR}/${BPN}-${PV}"
|
|||
PTEST_CONF = "${@base_contains('DISTRO_FEATURES', 'ptest', '--enable-tests', '', d)}"
|
||||
EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}"
|
||||
|
||||
EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '--with-init-script=sysvinit', '--with-init-script=systemd', d)}"
|
||||
|
||||
PACKAGECONFIG ??= "templates \
|
||||
${@base_contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \
|
||||
"
|
||||
|
@ -56,7 +59,7 @@ inherit autotools pkgconfig ptest update-rc.d systemd
|
|||
|
||||
SYSTEMD_PACKAGES = "${PN}-setup"
|
||||
SYSTEMD_SERVICE_${PN}-setup = "lxc.service"
|
||||
SYSTEMD_AUTO_ENABLE_${PN}-setup = "enable"
|
||||
SYSTEMD_AUTO_ENABLE_${PN}-setup = "disable"
|
||||
|
||||
INITSCRIPT_PACKAGES = "${PN}-setup"
|
||||
INITSCRIPT_NAME_{PN}-setup = "lxc"
|
||||
|
@ -72,6 +75,7 @@ RDEPENDS_${PN}-templates += "bash"
|
|||
|
||||
FILES_${PN}-setup += "/etc/tmpfiles.d"
|
||||
FILES_${PN}-setup += "/lib/systemd/system"
|
||||
FILES_${PN}-setup += "/usr/lib/systemd/system"
|
||||
FILES_${PN}-setup += "/etc/init.d"
|
||||
|
||||
PRIVATE_LIBS_${PN}-ptest = "liblxc.so.1"
|
||||
|
@ -90,10 +94,6 @@ do_install_append() {
|
|||
if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
|
||||
install -d ${D}${sysconfdir}/init.d
|
||||
cp ${S}/config/init/sysvinit/lxc ${D}${sysconfdir}/init.d
|
||||
else
|
||||
install -d ${D}${systemd_unitdir}/system
|
||||
install -m 755 ${S}/config/init/systemd/lxc.service ${D}${systemd_unitdir}/system/lxc.service
|
||||
install -m 755 ${S}/config/init/systemd/lxc-devsetup ${D}${libexecdir}/lxc/
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user