diff options
Diffstat (limited to 'recipes-containers/lxc/lxc_2.0.0.bb')
| -rw-r--r-- | recipes-containers/lxc/lxc_2.0.0.bb | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/recipes-containers/lxc/lxc_2.0.0.bb b/recipes-containers/lxc/lxc_2.0.0.bb new file mode 100644 index 00000000..34aab38a --- /dev/null +++ b/recipes-containers/lxc/lxc_2.0.0.bb | |||
| @@ -0,0 +1,168 @@ | |||
| 1 | DESCRIPTION = "lxc aims to use these new functionnalities to provide an userspace container object" | ||
| 2 | SECTION = "console/utils" | ||
| 3 | LICENSE = "GPLv2" | ||
| 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" | ||
| 5 | PRIORITY = "optional" | ||
| 6 | DEPENDS = "libxml2 libcap" | ||
| 7 | RDEPENDS_${PN} = " \ | ||
| 8 | rsync \ | ||
| 9 | gzip \ | ||
| 10 | libcap-bin \ | ||
| 11 | bridge-utils \ | ||
| 12 | dnsmasq \ | ||
| 13 | perl-module-strict \ | ||
| 14 | perl-module-getopt-long \ | ||
| 15 | perl-module-vars \ | ||
| 16 | perl-module-warnings-register \ | ||
| 17 | perl-module-exporter \ | ||
| 18 | perl-module-constant \ | ||
| 19 | perl-module-overload \ | ||
| 20 | perl-module-exporter-heavy \ | ||
| 21 | " | ||
| 22 | RDEPENDS_${PN}-ptest += "file make" | ||
| 23 | |||
| 24 | SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \ | ||
| 25 | file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \ | ||
| 26 | file://runtest.patch \ | ||
| 27 | file://run-ptest \ | ||
| 28 | file://automake-ensure-VPATH-builds-correctly.patch \ | ||
| 29 | file://lxc-fix-B-S.patch \ | ||
| 30 | file://lxc-doc-upgrade-to-use-docbook-3.1-DTD.patch \ | ||
| 31 | file://logs-optionally-use-base-filenames-to-report-src-fil.patch \ | ||
| 32 | " | ||
| 33 | |||
| 34 | SRC_URI[md5sum] = "04a7245a614cd3296b0ae9ceeeb83fbb" | ||
| 35 | SRC_URI[sha256sum] = "5b737e114d8ef1feb193fba936d77a5697a7c8a10199a068cdd90d1bd27c10e4" | ||
| 36 | |||
| 37 | S = "${WORKDIR}/${BPN}-${PV}" | ||
| 38 | |||
| 39 | # Let's not configure for the host distro. | ||
| 40 | # | ||
| 41 | PTEST_CONF = "${@base_contains('DISTRO_FEATURES', 'ptest', '--enable-tests', '', d)}" | ||
| 42 | EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}" | ||
| 43 | |||
| 44 | EXTRA_OECONF += "--with-init-script=\ | ||
| 45 | ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit,', '', d)}\ | ||
| 46 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" | ||
| 47 | |||
| 48 | EXTRA_OECONF += "--enable-log-src-basename" | ||
| 49 | |||
| 50 | PACKAGECONFIG ??= "templates \ | ||
| 51 | ${@base_contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \ | ||
| 52 | " | ||
| 53 | PACKAGECONFIG[doc] = "--enable-doc --enable-api-docs,--disable-doc --disable-api-docs,," | ||
| 54 | PACKAGECONFIG[rpath] = "--enable-rpath,--disable-rpath,," | ||
| 55 | PACKAGECONFIG[apparmour] = "--enable-apparmor,--disable-apparmor,apparmor,apparmor" | ||
| 56 | PACKAGECONFIG[templates] = ",,, ${PN}-templates" | ||
| 57 | PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux" | ||
| 58 | PACKAGECONFIG[seccomp] ="--enable-seccomp,--disable-seccomp,libseccomp,libseccomp" | ||
| 59 | PACKAGECONFIG[python] = "--enable-python,--disable-python,python3,python3-core" | ||
| 60 | |||
| 61 | # required by python3 to run setup.py | ||
| 62 | export BUILD_SYS | ||
| 63 | export HOST_SYS | ||
| 64 | export STAGING_INCDIR | ||
| 65 | export STAGING_LIBDIR | ||
| 66 | |||
| 67 | inherit autotools pkgconfig ptest update-rc.d systemd python3native | ||
| 68 | |||
| 69 | SYSTEMD_PACKAGES = "${PN}-setup" | ||
| 70 | SYSTEMD_SERVICE_${PN}-setup = "lxc.service" | ||
| 71 | SYSTEMD_AUTO_ENABLE_${PN}-setup = "disable" | ||
| 72 | |||
| 73 | INITSCRIPT_PACKAGES = "${PN}-setup" | ||
| 74 | INITSCRIPT_NAME_{PN}-setup = "lxc" | ||
| 75 | INITSCRIPT_PARAMS_${PN}-setup = "${OS_DEFAULT_INITSCRIPT_PARAMS}" | ||
| 76 | |||
| 77 | FILES_${PN}-doc = "${mandir} ${infodir}" | ||
| 78 | # For LXC the docdir only contains example configuration files and should be included in the lxc package | ||
| 79 | FILES_${PN} += "${docdir}" | ||
| 80 | FILES_${PN} += "${libdir}/python3*" | ||
| 81 | FILES_${PN}-dbg += "${libexecdir}/lxc/.debug" | ||
| 82 | PACKAGES =+ "${PN}-templates ${PN}-setup ${PN}-networking" | ||
| 83 | FILES_${PN}-templates += "${datadir}/lxc/templates" | ||
| 84 | RDEPENDS_${PN}-templates += "bash" | ||
| 85 | |||
| 86 | ALLOW_EMPTY_${PN}-networking = "1" | ||
| 87 | |||
| 88 | FILES_${PN}-setup += "/etc/tmpfiles.d" | ||
| 89 | FILES_${PN}-setup += "/lib/systemd/system" | ||
| 90 | FILES_${PN}-setup += "/usr/lib/systemd/system" | ||
| 91 | FILES_${PN}-setup += "/etc/init.d" | ||
| 92 | |||
| 93 | PRIVATE_LIBS_${PN}-ptest = "liblxc.so.1" | ||
| 94 | |||
| 95 | CACHED_CONFIGUREVARS += " \ | ||
| 96 | ac_cv_path_PYTHON='${STAGING_BINDIR_NATIVE}/python3-native/python3' \ | ||
| 97 | am_cv_python_pyexecdir='${exec_prefix}/${libdir}/python3.5/site-packages' \ | ||
| 98 | am_cv_python_pythondir='${prefix}/${libdir}/python3.5/site-packages' \ | ||
| 99 | " | ||
| 100 | |||
| 101 | do_install_append() { | ||
| 102 | # The /var/cache/lxc directory created by the Makefile | ||
| 103 | # is wiped out in volatile, we need to create this at boot. | ||
| 104 | rm -rf ${D}${localstatedir}/cache | ||
| 105 | install -d ${D}${sysconfdir}/default/volatiles | ||
| 106 | echo "d root root 0755 ${localstatedir}/cache/lxc none" \ | ||
| 107 | > ${D}${sysconfdir}/default/volatiles/99_lxc | ||
| 108 | |||
| 109 | for i in `grep -l "#! */bin/bash" ${D}${datadir}/lxc/hooks/*`; do \ | ||
| 110 | sed -e 's|#! */bin/bash|#!/bin/sh|' -i $i; done | ||
| 111 | |||
| 112 | if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
| 113 | install -d ${D}${sysconfdir}/init.d | ||
| 114 | install -m 755 config/init/sysvinit/lxc* ${D}${sysconfdir}/init.d | ||
| 115 | fi | ||
| 116 | |||
| 117 | # since python3-native is used for install location this will not be | ||
| 118 | # suitable for the target and we will have to correct the package install | ||
| 119 | if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then | ||
| 120 | if [ -d ${D}${exec_prefix}/lib/python* ]; then mv ${D}${exec_prefix}/lib/python* ${D}${libdir}/; fi | ||
| 121 | rmdir --ignore-fail-on-non-empty ${D}${exec_prefix}/lib | ||
| 122 | fi | ||
| 123 | } | ||
| 124 | |||
| 125 | EXTRA_OEMAKE += "TEST_DIR=${D}${PTEST_PATH}/src/tests" | ||
| 126 | |||
| 127 | do_install_ptest() { | ||
| 128 | oe_runmake -C src/tests install-ptest | ||
| 129 | } | ||
| 130 | |||
| 131 | pkg_postinst_${PN}() { | ||
| 132 | if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then | ||
| 133 | /etc/init.d/populate-volatile.sh update | ||
| 134 | fi | ||
| 135 | } | ||
| 136 | |||
| 137 | pkg_postinst_${PN}-networking() { | ||
| 138 | if [ "x$D" != "x" ]; then | ||
| 139 | exit 1 | ||
| 140 | fi | ||
| 141 | |||
| 142 | # setup for our bridge | ||
| 143 | echo "lxc.network.link=lxcbr0" >> ${sysconfdir}/lxc/default.conf | ||
| 144 | |||
| 145 | cat >> /etc/network/interfaces << EOF | ||
| 146 | |||
| 147 | auto lxcbr0 | ||
| 148 | iface lxcbr0 inet dhcp | ||
| 149 | bridge_ports eth0 | ||
| 150 | bridge_fd 0 | ||
| 151 | bridge_maxwait 0 | ||
| 152 | EOF | ||
| 153 | |||
| 154 | cat<<EOF>/etc/network/if-pre-up.d/lxcbr0 | ||
| 155 | #! /bin/sh | ||
| 156 | |||
| 157 | if test "x\$IFACE" = xlxcbr0 ; then | ||
| 158 | brctl show |grep lxcbr0 > /dev/null 2>/dev/null | ||
| 159 | if [ \$? != 0 ] ; then | ||
| 160 | brctl addbr lxcbr0 | ||
| 161 | brctl addif lxcbr0 eth0 | ||
| 162 | ip addr flush eth0 | ||
| 163 | ifconfig eth0 up | ||
| 164 | fi | ||
| 165 | fi | ||
| 166 | EOF | ||
| 167 | chmod 755 /etc/network/if-pre-up.d/lxcbr0 | ||
| 168 | } | ||
