From 9e1c5f6e85c61839f4bc7dacbbcdcb887e2fc13d Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Fri, 30 Jan 2015 00:16:06 -0500 Subject: lxc: add bridge setup configuration to -setup package Now that we have a lxc-setup package, we can start to define networking and other out of the box configuration details for those that opt to install it. These are by no means complete, and won't work for everyone, but they are a start. Signed-off-by: Bruce Ashfield --- recipes-containers/lxc/lxc_1.0.7.bb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'recipes-containers/lxc') diff --git a/recipes-containers/lxc/lxc_1.0.7.bb b/recipes-containers/lxc/lxc_1.0.7.bb index b1f47391..ecad31c9 100644 --- a/recipes-containers/lxc/lxc_1.0.7.bb +++ b/recipes-containers/lxc/lxc_1.0.7.bb @@ -103,3 +103,36 @@ pkg_postinst_${PN}() { /etc/init.d/populate-volatile.sh update fi } + +pkg_postinst_${PN}-setup() { + if [ "x$D" != "x" ]; then + exit 1 + fi + + # setup for our bridge + echo "lxc.network.link=lxcbr0" >> ${sysconfdir}/lxc/default.conf + +cat >> /etc/network/interfaces << EOF + +auto lxcbr0 +iface lxcbr0 inet dhcp + bridge_ports eth0 + bridge_fd 0 + bridge_maxwait 0 +EOF + +cat</etc/network/if-pre-up.d/lxcbr0 +#! /bin/sh + +if test "x\$IFACE" = xlxcbr0 ; then + brctl show |grep lxcbr0 > /dev/null 2>/dev/null + if [ \$? != 0 ] ; then + brctl addbr lxcbr0 + brctl addif lxcbr0 eth0 + ip addr flush eth0 + ifconfig eth0 up + fi +fi +EOF +chmod 755 /etc/network/if-pre-up.d/lxcbr0 +} -- cgit v1.2.3-54-g00ecf