summaryrefslogtreecommitdiffstats
path: root/recipes-containers/lxc
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2015-04-11 00:15:51 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2015-04-11 00:17:55 -0400
commit1365af123e45c8cc65b4206f9b5a6cca787438b6 (patch)
treef912fc8d92628e84359e9c49419f9a8afb3664fd /recipes-containers/lxc
parent19ca5c408ad14bef81d3e785f0cb4a70e95db467 (diff)
downloadmeta-virtualization-1365af123e45c8cc65b4206f9b5a6cca787438b6.tar.gz
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>
Diffstat (limited to 'recipes-containers/lxc')
-rw-r--r--recipes-containers/lxc/files/lxc-helper-create-local-action-function.patch38
-rw-r--r--recipes-containers/lxc/lxc_1.0.7.bb10
2 files changed, 43 insertions, 5 deletions
diff --git a/recipes-containers/lxc/files/lxc-helper-create-local-action-function.patch b/recipes-containers/lxc/files/lxc-helper-create-local-action-function.patch
new file mode 100644
index 00000000..d1d31eea
--- /dev/null
+++ b/recipes-containers/lxc/files/lxc-helper-create-local-action-function.patch
@@ -0,0 +1,38 @@
1From aada9da49caca9e4a25764df2d2a2c11d9d95dbb Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@windriver.com>
3Date: Fri, 10 Apr 2015 10:55:49 -0400
4Subject: [PATCH] lxc-helper: create local action() function
5
6Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
7---
8 config/init/sysvinit/lxc.in | 14 ++++++++++++++
9 1 file changed, 14 insertions(+)
10
11diff --git a/config/init/sysvinit/lxc.in b/config/init/sysvinit/lxc.in
12index 19c102e74c86..9f96a4f7496f 100644
13--- a/config/init/sysvinit/lxc.in
14+++ b/config/init/sysvinit/lxc.in
15@@ -52,6 +52,20 @@ test ! -r "$sysconfdir"/sysconfig/lxc ||
16 # Check for needed utility program
17 [ -x "$bindir"/lxc-autostart ] || exit 1
18
19+action()
20+{
21+ local STRING rc
22+
23+ STRING=$1
24+ echo -n "$STRING "
25+
26+ shift
27+ "$@" && success $"$STRING" || failure $"$STRING"
28+ rc=$?
29+
30+ return $rc
31+}
32+
33 # If libvirtd is providing the bridge, it might not be
34 # immediately available, so wait a bit for it before starting
35 # up the containers or else any that use the bridge will fail
36--
372.1.0
38
diff --git a/recipes-containers/lxc/lxc_1.0.7.bb b/recipes-containers/lxc/lxc_1.0.7.bb
index c9eef754..55da522f 100644
--- a/recipes-containers/lxc/lxc_1.0.7.bb
+++ b/recipes-containers/lxc/lxc_1.0.7.bb
@@ -27,6 +27,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
27 file://run-ptest \ 27 file://run-ptest \
28 file://automake-ensure-VPATH-builds-correctly.patch \ 28 file://automake-ensure-VPATH-builds-correctly.patch \
29 file://add-lxc.rebootsignal.patch \ 29 file://add-lxc.rebootsignal.patch \
30 file://lxc-helper-create-local-action-function.patch \
30 file://document-lxc.rebootsignal.patch \ 31 file://document-lxc.rebootsignal.patch \
31 file://lxc-busybox-use-lxc.rebootsignal-SIGTERM.patch \ 32 file://lxc-busybox-use-lxc.rebootsignal-SIGTERM.patch \
32 file://ppc-add-seccomp-support-for-lxc.patch \ 33 file://ppc-add-seccomp-support-for-lxc.patch \
@@ -42,6 +43,8 @@ S = "${WORKDIR}/${BPN}-${PV}"
42PTEST_CONF = "${@base_contains('DISTRO_FEATURES', 'ptest', '--enable-tests', '', d)}" 43PTEST_CONF = "${@base_contains('DISTRO_FEATURES', 'ptest', '--enable-tests', '', d)}"
43EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}" 44EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}"
44 45
46EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '--with-init-script=sysvinit', '--with-init-script=systemd', d)}"
47
45PACKAGECONFIG ??= "templates \ 48PACKAGECONFIG ??= "templates \
46 ${@base_contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \ 49 ${@base_contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \
47" 50"
@@ -56,7 +59,7 @@ inherit autotools pkgconfig ptest update-rc.d systemd
56 59
57SYSTEMD_PACKAGES = "${PN}-setup" 60SYSTEMD_PACKAGES = "${PN}-setup"
58SYSTEMD_SERVICE_${PN}-setup = "lxc.service" 61SYSTEMD_SERVICE_${PN}-setup = "lxc.service"
59SYSTEMD_AUTO_ENABLE_${PN}-setup = "enable" 62SYSTEMD_AUTO_ENABLE_${PN}-setup = "disable"
60 63
61INITSCRIPT_PACKAGES = "${PN}-setup" 64INITSCRIPT_PACKAGES = "${PN}-setup"
62INITSCRIPT_NAME_{PN}-setup = "lxc" 65INITSCRIPT_NAME_{PN}-setup = "lxc"
@@ -72,6 +75,7 @@ RDEPENDS_${PN}-templates += "bash"
72 75
73FILES_${PN}-setup += "/etc/tmpfiles.d" 76FILES_${PN}-setup += "/etc/tmpfiles.d"
74FILES_${PN}-setup += "/lib/systemd/system" 77FILES_${PN}-setup += "/lib/systemd/system"
78FILES_${PN}-setup += "/usr/lib/systemd/system"
75FILES_${PN}-setup += "/etc/init.d" 79FILES_${PN}-setup += "/etc/init.d"
76 80
77PRIVATE_LIBS_${PN}-ptest = "liblxc.so.1" 81PRIVATE_LIBS_${PN}-ptest = "liblxc.so.1"
@@ -90,10 +94,6 @@ do_install_append() {
90 if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then 94 if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
91 install -d ${D}${sysconfdir}/init.d 95 install -d ${D}${sysconfdir}/init.d
92 cp ${S}/config/init/sysvinit/lxc ${D}${sysconfdir}/init.d 96 cp ${S}/config/init/sysvinit/lxc ${D}${sysconfdir}/init.d
93 else
94 install -d ${D}${systemd_unitdir}/system
95 install -m 755 ${S}/config/init/systemd/lxc.service ${D}${systemd_unitdir}/system/lxc.service
96 install -m 755 ${S}/config/init/systemd/lxc-devsetup ${D}${libexecdir}/lxc/
97 fi 97 fi
98} 98}
99 99