diff options
Diffstat (limited to 'recipes-containers/lxc/lxc_git.bb')
| -rw-r--r-- | recipes-containers/lxc/lxc_git.bb | 200 |
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 @@ | |||
| 1 | DESCRIPTION = "lxc aims to use these new functionnalities to provide an userspace container object" | ||
| 2 | SECTION = "console/utils" | ||
| 3 | LICENSE = "LGPLv2.1 & GPLv2" | ||
| 4 | LIC_FILES_CHKSUM = "file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c \ | ||
| 5 | file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ | ||
| 6 | " | ||
| 7 | |||
| 8 | DEPENDS = "libxml2 libcap" | ||
| 9 | RDEPENDS:${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 | |||
| 33 | RDEPENDS:${PN}:append:libc-glibc = " glibc-utils" | ||
| 34 | |||
| 35 | RDEPENDS:${PN}-ptest += "file make gmp nettle gnutls bash libgcc" | ||
| 36 | |||
| 37 | RDEPENDS:${PN}-networking += "iptables" | ||
| 38 | |||
| 39 | SRC_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 | |||
| 55 | SRCREV = "cec7cb14b2a4367d4cb21a90e1b90d0f98a9d874" | ||
| 56 | PV = "4.0.10+git${SRCPV}" | ||
| 57 | |||
| 58 | S = "${WORKDIR}/git" | ||
| 59 | |||
| 60 | # Let's not configure for the host distro. | ||
| 61 | # | ||
| 62 | PTEST_CONF = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '--enable-tests', '', d)}" | ||
| 63 | EXTRA_OECONF += "--with-distro=${DISTRO} ${PTEST_CONF}" | ||
| 64 | |||
| 65 | EXTRA_OECONF += "--with-init-script=\ | ||
| 66 | ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit,', '', d)}\ | ||
| 67 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}" | ||
| 68 | |||
| 69 | EXTRA_OECONF += "--enable-log-src-basename --disable-werror" | ||
| 70 | |||
| 71 | PACKAGECONFIG ??= "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 | " | ||
| 76 | PACKAGECONFIG[doc] = "--enable-doc --enable-api-docs,--disable-doc --disable-api-docs,," | ||
| 77 | PACKAGECONFIG[rpath] = "--enable-rpath,--disable-rpath,," | ||
| 78 | PACKAGECONFIG[apparmor] = "--enable-apparmor,--disable-apparmor,apparmor,apparmor" | ||
| 79 | PACKAGECONFIG[templates] = ",,, ${PN}-templates" | ||
| 80 | PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux" | ||
| 81 | PACKAGECONFIG[seccomp] ="--enable-seccomp,--disable-seccomp,libseccomp,libseccomp" | ||
| 82 | PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd," | ||
| 83 | |||
| 84 | # required by python3 to run setup.py | ||
| 85 | export BUILD_SYS | ||
| 86 | export HOST_SYS | ||
| 87 | export STAGING_INCDIR | ||
| 88 | export STAGING_LIBDIR | ||
| 89 | |||
| 90 | inherit autotools pkgconfig ptest update-rc.d systemd python3native | ||
| 91 | |||
| 92 | SYSTEMD_PACKAGES = "${PN} ${PN}-networking" | ||
| 93 | SYSTEMD_SERVICE:${PN} = "lxc.service" | ||
| 94 | SYSTEMD_AUTO_ENABLE:${PN} = "disable" | ||
| 95 | SYSTEMD_SERVICE:${PN}-networking = "lxc-net.service" | ||
| 96 | SYSTEMD_AUTO_ENABLE:${PN}-networking = "enable" | ||
| 97 | |||
| 98 | INITSCRIPT_PACKAGES = "${PN} ${PN}-networking" | ||
| 99 | INITSCRIPT_NAME:${PN} = "lxc-containers" | ||
| 100 | INITSCRIPT_PARAMS:${PN} = "defaults" | ||
| 101 | INITSCRIPT_NAME:${PN}-networking = "lxc-net" | ||
| 102 | INITSCRIPT_PARAMS:${PN}-networking = "defaults" | ||
| 103 | |||
| 104 | FILES:${PN}-doc = "${mandir} ${infodir}" | ||
| 105 | # For LXC the docdir only contains example configuration files and should be included in the lxc package | ||
| 106 | FILES:${PN} += "${docdir}" | ||
| 107 | FILES:${PN} += "${libdir}/python3*" | ||
| 108 | FILES:${PN} += "${datadir}/bash-completion" | ||
| 109 | FILES:${PN}-dbg += "${libexecdir}/lxc/.debug" | ||
| 110 | FILES:${PN}-dbg += "${libexecdir}/lxc/hooks/.debug" | ||
| 111 | PACKAGES =+ "${PN}-templates ${PN}-networking ${PN}-lua" | ||
| 112 | FILES:lua-${PN} = "${datadir}/lua ${libdir}/lua" | ||
| 113 | FILES:lua-${PN}-dbg += "${libdir}/lua/lxc/.debug" | ||
| 114 | FILES:${PN}-templates += "${datadir}/lxc/templates" | ||
| 115 | RDEPENDS:${PN}-templates += "bash" | ||
| 116 | |||
| 117 | FILES:${PN}-networking += " \ | ||
| 118 | ${sysconfdir}/init.d/lxc-net \ | ||
| 119 | ${sysconfdir}/default/lxc-net \ | ||
| 120 | " | ||
| 121 | |||
| 122 | CACHED_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 | |||
| 128 | do_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 | |||
| 160 | EXTRA_OEMAKE += "TEST_DIR=${D}${PTEST_PATH}/src/tests" | ||
| 161 | |||
| 162 | do_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 | |||
| 168 | pkg_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 | |||
| 174 | pkg_postinst:${PN}-networking() { | ||
| 175 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
| 176 | cat >> $D/etc/network/interfaces << EOF | ||
| 177 | |||
| 178 | auto lxcbr0 | ||
| 179 | iface lxcbr0 inet dhcp | ||
| 180 | bridge_ports eth0 | ||
| 181 | bridge_fd 0 | ||
| 182 | bridge_maxwait 0 | ||
| 183 | EOF | ||
| 184 | |||
| 185 | cat<<EOF>$D/etc/network/if-pre-up.d/lxcbr0 | ||
| 186 | #! /bin/sh | ||
| 187 | |||
| 188 | if 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 | ||
| 196 | fi | ||
| 197 | EOF | ||
| 198 | chmod 755 $D/etc/network/if-pre-up.d/lxcbr0 | ||
| 199 | fi | ||
| 200 | } | ||
