diff options
| -rw-r--r-- | recipes-containers/lxc/files/lxc-net | 9 | ||||
| -rw-r--r-- | recipes-containers/lxc/lxc_2.0.8.bb | 24 |
2 files changed, 24 insertions, 9 deletions
diff --git a/recipes-containers/lxc/files/lxc-net b/recipes-containers/lxc/files/lxc-net new file mode 100644 index 00000000..1c59b705 --- /dev/null +++ b/recipes-containers/lxc/files/lxc-net | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | USE_LXC_BRIDGE="true" | ||
| 2 | LXC_BRIDGE="lxcbr0" | ||
| 3 | LXC_ADDR="10.0.3.1" | ||
| 4 | LXC_NETMASK="255.255.255.0" | ||
| 5 | LXC_NETWORK="10.0.3.0/24" | ||
| 6 | LXC_DHCP_RANGE="10.0.3.2,10.0.3.254" | ||
| 7 | LXC_DHCP_MAX="253" | ||
| 8 | LXC_DHCP_CONFILE="" | ||
| 9 | LXC_DOMAIN="" | ||
diff --git a/recipes-containers/lxc/lxc_2.0.8.bb b/recipes-containers/lxc/lxc_2.0.8.bb index 4473fdd3..46fa9a75 100644 --- a/recipes-containers/lxc/lxc_2.0.8.bb +++ b/recipes-containers/lxc/lxc_2.0.8.bb | |||
| @@ -30,6 +30,8 @@ RDEPENDS_${PN}_append_libc-glibc = " glibc-utils" | |||
| 30 | 30 | ||
| 31 | RDEPENDS_${PN}-ptest += "file make gmp nettle gnutls bash" | 31 | RDEPENDS_${PN}-ptest += "file make gmp nettle gnutls bash" |
| 32 | 32 | ||
| 33 | RDEPENDS_${PN}-networking += "iptables" | ||
| 34 | |||
| 33 | SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \ | 35 | SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \ |
| 34 | file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \ | 36 | file://lxc-1.0.0-disable-udhcp-from-busybox-template.patch \ |
| 35 | file://runtest.patch \ | 37 | file://runtest.patch \ |
| @@ -40,6 +42,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \ | |||
| 40 | file://logs-optionally-use-base-filenames-to-report-src-fil.patch \ | 42 | file://logs-optionally-use-base-filenames-to-report-src-fil.patch \ |
| 41 | file://cgroups-work-around-issue-in-gcc-7.patch \ | 43 | file://cgroups-work-around-issue-in-gcc-7.patch \ |
| 42 | file://dnsmasq.conf \ | 44 | file://dnsmasq.conf \ |
| 45 | file://lxc-net \ | ||
| 43 | " | 46 | " |
| 44 | 47 | ||
| 45 | SRC_URI[md5sum] = "7bfd95280522d7936c0979dfea92cdb5" | 48 | SRC_URI[md5sum] = "7bfd95280522d7936c0979dfea92cdb5" |
| @@ -107,7 +110,10 @@ FILES_lua-${PN}-dbg += "${libdir}/lua/lxc/.debug" | |||
| 107 | FILES_${PN}-templates += "${datadir}/lxc/templates" | 110 | FILES_${PN}-templates += "${datadir}/lxc/templates" |
| 108 | RDEPENDS_${PN}-templates += "bash" | 111 | RDEPENDS_${PN}-templates += "bash" |
| 109 | 112 | ||
| 110 | FILES_${PN}-networking += "${sysconfdir}/init.d/lxc-net" | 113 | FILES_${PN}-networking += " \ |
| 114 | ${sysconfdir}/init.d/lxc-net \ | ||
| 115 | ${sysconfdir}/default/lxc-net \ | ||
| 116 | " | ||
| 111 | 117 | ||
| 112 | PRIVATE_LIBS_${PN}-ptest = "liblxc.so.1" | 118 | PRIVATE_LIBS_${PN}-ptest = "liblxc.so.1" |
| 113 | 119 | ||
| @@ -138,6 +144,11 @@ do_install_append() { | |||
| 138 | rmdir --ignore-fail-on-non-empty ${D}${exec_prefix}/lib | 144 | rmdir --ignore-fail-on-non-empty ${D}${exec_prefix}/lib |
| 139 | fi | 145 | fi |
| 140 | 146 | ||
| 147 | # /etc/default/lxc sources lxc-net, this allows lxc bridge when lxc-networking | ||
| 148 | # is not installed this results in no lxcbr0, but when lxc-networking is installed | ||
| 149 | # lxcbr0 will be fully configured. | ||
| 150 | install -m 644 ${WORKDIR}/lxc-net ${D}${sysconfdir}/default/ | ||
| 151 | |||
| 141 | # Force the main dnsmasq instance to bind only to specified interfaces and | 152 | # Force the main dnsmasq instance to bind only to specified interfaces and |
| 142 | # to not bind to virbr0. Libvirt will run its own instance on this interface. | 153 | # to not bind to virbr0. Libvirt will run its own instance on this interface. |
| 143 | install -d ${D}/${sysconfdir}/dnsmasq.d | 154 | install -d ${D}/${sysconfdir}/dnsmasq.d |
| @@ -156,14 +167,8 @@ pkg_postinst_${PN}() { | |||
| 156 | fi | 167 | fi |
| 157 | } | 168 | } |
| 158 | 169 | ||
| 159 | pkg_postinst_${PN}-networking() { | 170 | pkg_postinst_ontarget_${PN}-networking() { |
| 160 | if [ "x$D" != "x" ]; then | 171 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then |
| 161 | exit 1 | ||
| 162 | fi | ||
| 163 | |||
| 164 | # setup for our bridge | ||
| 165 | echo "lxc.network.link=lxcbr0" >> ${sysconfdir}/lxc/default.conf | ||
| 166 | |||
| 167 | cat >> /etc/network/interfaces << EOF | 172 | cat >> /etc/network/interfaces << EOF |
| 168 | 173 | ||
| 169 | auto lxcbr0 | 174 | auto lxcbr0 |
| @@ -187,4 +192,5 @@ if test "x\$IFACE" = xlxcbr0 ; then | |||
| 187 | fi | 192 | fi |
| 188 | EOF | 193 | EOF |
| 189 | chmod 755 /etc/network/if-pre-up.d/lxcbr0 | 194 | chmod 755 /etc/network/if-pre-up.d/lxcbr0 |
| 195 | fi | ||
| 190 | } | 196 | } |
