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