summaryrefslogtreecommitdiffstats
path: root/recipes-containers/lxc/lxc_3.2.1.bb
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-containers/lxc/lxc_3.2.1.bb')
-rw-r--r--recipes-containers/lxc/lxc_3.2.1.bb196
1 files changed, 196 insertions, 0 deletions
diff --git a/recipes-containers/lxc/lxc_3.2.1.bb b/recipes-containers/lxc/lxc_3.2.1.bb
new file mode 100644
index 00000000..585ab8fc
--- /dev/null
+++ b/recipes-containers/lxc/lxc_3.2.1.bb
@@ -0,0 +1,196 @@
1DESCRIPTION = "lxc aims to use these new functionnalities to provide an userspace container object"
2SECTION = "console/utils"
3LICENSE = "LGPLv2.1"
4LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
5DEPENDS = "libxml2 libcap"
6RDEPENDS_${PN} = " \
7 rsync \
8 gzip \
9 xz \
10 tar \
11 wget \
12 libcap-bin \
13 bridge-utils \
14 dnsmasq \
15 perl-module-strict \
16 perl-module-getopt-long \
17 perl-module-vars \
18 perl-module-exporter \
19 perl-module-constant \
20 perl-module-overload \
21 perl-module-exporter-heavy \
22 gmp \
23 libidn \
24 gnutls \
25 nettle \
26 util-linux-mountpoint \
27 util-linux-getopt \
28"
29
30RDEPENDS_${PN}_append_libc-glibc = " glibc-utils"
31
32RDEPENDS_${PN}-ptest += "file make gmp nettle gnutls bash libgcc"
33
34RDEPENDS_${PN}-networking += "iptables"
35
36SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
37 file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \
38 file://run-ptest \
39 file://lxc-fix-B-S.patch \
40 file://lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch \
41 file://logs-optionally-use-base-filenames-to-report-src-fil.patch \
42 file://templates-actually-create-DOWNLOAD_TEMP-directory.patch \
43 file://template-make-busybox-template-compatible-with-core-.patch \
44 file://tests-our-init-is-not-busybox.patch \
45 file://tests-add-no-validate-when-using-download-template.patch \
46 file://dnsmasq.conf \
47 file://lxc-net \
48 "
49
50SRC_URI[md5sum] = "4886c8d1c8e221fe526eefcb47857b85"
51SRC_URI[sha256sum] = "5f903986a4b17d607eea28c0aa56bf1e76e8707747b1aa07d31680338b1cc3d4"
52
53S = "${WORKDIR}/${BPN}-${PV}"
54
55# Let's not configure for the host distro.
56#
57PTEST_CONF = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '--enable-tests', '', d)}"
58EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}"
59
60EXTRA_OECONF += "--with-init-script=\
61${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit,', '', d)}\
62${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
63
64EXTRA_OECONF += "--enable-log-src-basename"
65
66CFLAGS_append = " -Wno-error=deprecated-declarations"
67
68PACKAGECONFIG ??= "templates \
69 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
70 ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \
71"
72PACKAGECONFIG[doc] = "--enable-doc --enable-api-docs,--disable-doc --disable-api-docs,,"
73PACKAGECONFIG[rpath] = "--enable-rpath,--disable-rpath,,"
74PACKAGECONFIG[apparmor] = "--enable-apparmor,--disable-apparmor,apparmor,apparmor"
75PACKAGECONFIG[templates] = ",,, ${PN}-templates"
76PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux"
77PACKAGECONFIG[seccomp] ="--enable-seccomp,--disable-seccomp,libseccomp,libseccomp"
78PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd,"
79
80# required by python3 to run setup.py
81export BUILD_SYS
82export HOST_SYS
83export STAGING_INCDIR
84export STAGING_LIBDIR
85
86inherit autotools pkgconfig ptest update-rc.d systemd python3native
87
88SYSTEMD_PACKAGES = "${PN} ${PN}-networking"
89SYSTEMD_SERVICE_${PN} = "lxc.service"
90SYSTEMD_AUTO_ENABLE_${PN} = "disable"
91SYSTEMD_SERVICE_${PN}-networking = "lxc-net.service"
92SYSTEMD_AUTO_ENABLE_${PN}-networking = "enable"
93
94INITSCRIPT_PACKAGES = "${PN} ${PN}-networking"
95INITSCRIPT_NAME_${PN} = "lxc-containers"
96INITSCRIPT_PARAMS_${PN} = "defaults"
97INITSCRIPT_NAME_${PN}-networking = "lxc-net"
98INITSCRIPT_PARAMS_${PN}-networking = "defaults"
99
100FILES_${PN}-doc = "${mandir} ${infodir}"
101# For LXC the docdir only contains example configuration files and should be included in the lxc package
102FILES_${PN} += "${docdir}"
103FILES_${PN} += "${libdir}/python3*"
104FILES_${PN} += "${datadir}/bash-completion"
105FILES_${PN}-dbg += "${libexecdir}/lxc/.debug"
106FILES_${PN}-dbg += "${libexecdir}/lxc/hooks/.debug"
107PACKAGES =+ "${PN}-templates ${PN}-networking ${PN}-lua"
108FILES_lua-${PN} = "${datadir}/lua ${libdir}/lua"
109FILES_lua-${PN}-dbg += "${libdir}/lua/lxc/.debug"
110FILES_${PN}-templates += "${datadir}/lxc/templates"
111RDEPENDS_${PN}-templates += "bash"
112
113FILES_${PN}-networking += " \
114 ${sysconfdir}/init.d/lxc-net \
115 ${sysconfdir}/default/lxc-net \
116"
117
118CACHED_CONFIGUREVARS += " \
119 ac_cv_path_PYTHON='${STAGING_BINDIR_NATIVE}/python3-native/python3' \
120 am_cv_python_pyexecdir='${exec_prefix}/${libdir}/python3.5/site-packages' \
121 am_cv_python_pythondir='${prefix}/${libdir}/python3.5/site-packages' \
122"
123
124do_install_append() {
125 # The /var/cache/lxc directory created by the Makefile
126 # is wiped out in volatile, we need to create this at boot.
127 rm -rf ${D}${localstatedir}/cache
128 install -d ${D}${sysconfdir}/default/volatiles
129 echo "d root root 0755 ${localstatedir}/cache/lxc none" \
130 > ${D}${sysconfdir}/default/volatiles/99_lxc
131
132 for i in `grep -l "#! */bin/bash" ${D}${datadir}/lxc/hooks/*`; do \
133 sed -e 's|#! */bin/bash|#!/bin/sh|' -i $i; done
134
135 install -d ${D}${sysconfdir}/init.d
136 install -m 755 config/init/sysvinit/lxc* ${D}${sysconfdir}/init.d
137
138 # since python3-native is used for install location this will not be
139 # suitable for the target and we will have to correct the package install
140 if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then
141 if [ -d ${D}${exec_prefix}/lib/python* ]; then mv ${D}${exec_prefix}/lib/python* ${D}${libdir}/; fi
142 rmdir --ignore-fail-on-non-empty ${D}${exec_prefix}/lib
143 fi
144
145 # /etc/default/lxc sources lxc-net, this allows lxc bridge when lxc-networking
146 # is not installed this results in no lxcbr0, but when lxc-networking is installed
147 # lxcbr0 will be fully configured.
148 install -m 644 ${WORKDIR}/lxc-net ${D}${sysconfdir}/default/
149
150 # Force the main dnsmasq instance to bind only to specified interfaces and
151 # to not bind to virbr0. Libvirt will run its own instance on this interface.
152 install -d ${D}/${sysconfdir}/dnsmasq.d
153 install -m 644 ${WORKDIR}/dnsmasq.conf ${D}/${sysconfdir}/dnsmasq.d/lxc
154}
155
156EXTRA_OEMAKE += "TEST_DIR=${D}${PTEST_PATH}/src/tests"
157
158do_install_ptest() {
159 # Move tests to the "ptest directory"
160 install -d ${D}/${PTEST_PATH}/tests
161 mv ${D}/usr/bin/lxc-test-* ${D}/${PTEST_PATH}/tests/.
162}
163
164pkg_postinst_${PN}() {
165 if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
166 /etc/init.d/populate-volatile.sh update
167 fi
168}
169
170pkg_postinst_ontarget_${PN}-networking() {
171if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
172cat >> /etc/network/interfaces << EOF
173
174auto lxcbr0
175iface lxcbr0 inet dhcp
176 bridge_ports eth0
177 bridge_fd 0
178 bridge_maxwait 0
179EOF
180
181cat<<EOF>/etc/network/if-pre-up.d/lxcbr0
182#! /bin/sh
183
184if test "x\$IFACE" = xlxcbr0 ; then
185 brctl show |grep lxcbr0 > /dev/null 2>/dev/null
186 if [ \$? != 0 ] ; then
187 brctl addbr lxcbr0
188 brctl addif lxcbr0 eth0
189 ip addr flush eth0
190 ifconfig eth0 up
191 fi
192fi
193EOF
194chmod 755 /etc/network/if-pre-up.d/lxcbr0
195fi
196}