diff options
Diffstat (limited to 'recipes-containers/lxc/lxc_3.2.1.bb')
| -rw-r--r-- | recipes-containers/lxc/lxc_3.2.1.bb | 196 |
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 @@ | |||
| 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-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 | |||
| 30 | RDEPENDS_${PN}_append_libc-glibc = " glibc-utils" | ||
| 31 | |||
| 32 | RDEPENDS_${PN}-ptest += "file make gmp nettle gnutls bash libgcc" | ||
| 33 | |||
| 34 | RDEPENDS_${PN}-networking += "iptables" | ||
| 35 | |||
| 36 | SRC_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 | |||
| 50 | SRC_URI[md5sum] = "4886c8d1c8e221fe526eefcb47857b85" | ||
| 51 | SRC_URI[sha256sum] = "5f903986a4b17d607eea28c0aa56bf1e76e8707747b1aa07d31680338b1cc3d4" | ||
| 52 | |||
| 53 | S = "${WORKDIR}/${BPN}-${PV}" | ||
| 54 | |||
| 55 | # Let's not configure for the host distro. | ||
| 56 | # | ||
| 57 | PTEST_CONF = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '--enable-tests', '', d)}" | ||
| 58 | EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}" | ||
| 59 | |||
| 60 | EXTRA_OECONF += "--with-init-script=\ | ||
| 61 | ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit,', '', d)}\ | ||
| 62 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" | ||
| 63 | |||
| 64 | EXTRA_OECONF += "--enable-log-src-basename" | ||
| 65 | |||
| 66 | CFLAGS_append = " -Wno-error=deprecated-declarations" | ||
| 67 | |||
| 68 | PACKAGECONFIG ??= "templates \ | ||
| 69 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \ | ||
| 70 | ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \ | ||
| 71 | " | ||
| 72 | PACKAGECONFIG[doc] = "--enable-doc --enable-api-docs,--disable-doc --disable-api-docs,," | ||
| 73 | PACKAGECONFIG[rpath] = "--enable-rpath,--disable-rpath,," | ||
| 74 | PACKAGECONFIG[apparmor] = "--enable-apparmor,--disable-apparmor,apparmor,apparmor" | ||
| 75 | PACKAGECONFIG[templates] = ",,, ${PN}-templates" | ||
| 76 | PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux" | ||
| 77 | PACKAGECONFIG[seccomp] ="--enable-seccomp,--disable-seccomp,libseccomp,libseccomp" | ||
| 78 | PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd," | ||
| 79 | |||
| 80 | # required by python3 to run setup.py | ||
| 81 | export BUILD_SYS | ||
| 82 | export HOST_SYS | ||
| 83 | export STAGING_INCDIR | ||
| 84 | export STAGING_LIBDIR | ||
| 85 | |||
| 86 | inherit autotools pkgconfig ptest update-rc.d systemd python3native | ||
| 87 | |||
| 88 | SYSTEMD_PACKAGES = "${PN} ${PN}-networking" | ||
| 89 | SYSTEMD_SERVICE_${PN} = "lxc.service" | ||
| 90 | SYSTEMD_AUTO_ENABLE_${PN} = "disable" | ||
| 91 | SYSTEMD_SERVICE_${PN}-networking = "lxc-net.service" | ||
| 92 | SYSTEMD_AUTO_ENABLE_${PN}-networking = "enable" | ||
| 93 | |||
| 94 | INITSCRIPT_PACKAGES = "${PN} ${PN}-networking" | ||
| 95 | INITSCRIPT_NAME_${PN} = "lxc-containers" | ||
| 96 | INITSCRIPT_PARAMS_${PN} = "defaults" | ||
| 97 | INITSCRIPT_NAME_${PN}-networking = "lxc-net" | ||
| 98 | INITSCRIPT_PARAMS_${PN}-networking = "defaults" | ||
| 99 | |||
| 100 | FILES_${PN}-doc = "${mandir} ${infodir}" | ||
| 101 | # For LXC the docdir only contains example configuration files and should be included in the lxc package | ||
| 102 | FILES_${PN} += "${docdir}" | ||
| 103 | FILES_${PN} += "${libdir}/python3*" | ||
| 104 | FILES_${PN} += "${datadir}/bash-completion" | ||
| 105 | FILES_${PN}-dbg += "${libexecdir}/lxc/.debug" | ||
| 106 | FILES_${PN}-dbg += "${libexecdir}/lxc/hooks/.debug" | ||
| 107 | PACKAGES =+ "${PN}-templates ${PN}-networking ${PN}-lua" | ||
| 108 | FILES_lua-${PN} = "${datadir}/lua ${libdir}/lua" | ||
| 109 | FILES_lua-${PN}-dbg += "${libdir}/lua/lxc/.debug" | ||
| 110 | FILES_${PN}-templates += "${datadir}/lxc/templates" | ||
| 111 | RDEPENDS_${PN}-templates += "bash" | ||
| 112 | |||
| 113 | FILES_${PN}-networking += " \ | ||
| 114 | ${sysconfdir}/init.d/lxc-net \ | ||
| 115 | ${sysconfdir}/default/lxc-net \ | ||
| 116 | " | ||
| 117 | |||
| 118 | CACHED_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 | |||
| 124 | do_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 | |||
| 156 | EXTRA_OEMAKE += "TEST_DIR=${D}${PTEST_PATH}/src/tests" | ||
| 157 | |||
| 158 | do_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 | |||
| 164 | pkg_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 | |||
| 170 | pkg_postinst_ontarget_${PN}-networking() { | ||
| 171 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
| 172 | cat >> /etc/network/interfaces << EOF | ||
| 173 | |||
| 174 | auto lxcbr0 | ||
| 175 | iface lxcbr0 inet dhcp | ||
| 176 | bridge_ports eth0 | ||
| 177 | bridge_fd 0 | ||
| 178 | bridge_maxwait 0 | ||
| 179 | EOF | ||
| 180 | |||
| 181 | cat<<EOF>/etc/network/if-pre-up.d/lxcbr0 | ||
| 182 | #! /bin/sh | ||
| 183 | |||
| 184 | if 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 | ||
| 192 | fi | ||
| 193 | EOF | ||
| 194 | chmod 755 /etc/network/if-pre-up.d/lxcbr0 | ||
| 195 | fi | ||
| 196 | } | ||
