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