From 4e90888bcf5558a760a128a65fd5e2e3479c312b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 4 Apr 2014 09:55:02 +0200 Subject: [PATCH] Make it possible to override bridge if for LXC For example Ubuntu installs a bridge called `virbr0` by default for LXC. Using this system-provided bridge avoids having to configure one specifically before gitian building. This commits makes it possible to override the bridge used by gitian using the environment variable LXC_BRIDGE. The default is still to use `br0` as before. --- etc/lxc.config.in | 2 +- libexec/config-lxc | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/lxc.config.in b/etc/lxc.config.in index 5397170..74a9c82 100644 --- a/etc/lxc.config.in +++ b/etc/lxc.config.in @@ -30,5 +30,5 @@ lxc.mount.entry=sysfs ROOTFS/sys sysfs defaults 0 0 # the environment variables GITIAN_HOST_IP and LXC_GUEST_IP appropriately. lxc.network.type = veth lxc.network.flags = up -lxc.network.link = br0 +lxc.network.link = GUESTLINK lxc.network.ipv4 = GUESTIP/24 diff --git a/libexec/config-lxc b/libexec/config-lxc index fa6cac0..ddeabcf 100755 --- a/libexec/config-lxc +++ b/libexec/config-lxc @@ -6,4 +6,8 @@ if [ -z "$LXC_GUEST_IP" ]; then LXC_GUEST_IP=10.0.2.5 fi -sed "s;ROOTFS;$wd/target-$LXC_SUITE-$LXC_ARCH;;s;ARCH;$LXC_ARCH;g;;s;GUESTIP;$LXC_GUEST_IP;g" < etc/lxc.config.in > var/lxc.config +if [ -z "$LXC_BRIDGE" ]; then + LXC_BRIDGE=br0 +fi + +sed "s;ROOTFS;$wd/target-$LXC_SUITE-$LXC_ARCH;;s;ARCH;$LXC_ARCH;g;;s;GUESTIP;$LXC_GUEST_IP;g;s;GUESTLINK;$LXC_BRIDGE;g" < etc/lxc.config.in > var/lxc.config