[PATCH] adt-build-lxc: don't hardcode bridge interface
Antonio Terceiro
terceiro at debian.org
Sat Nov 28 11:21:45 UTC 2015
---
tools/adt-build-lxc | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/tools/adt-build-lxc b/tools/adt-build-lxc
index 97c387f..9002fc1 100755
--- a/tools/adt-build-lxc
+++ b/tools/adt-build-lxc
@@ -62,11 +62,20 @@ proxy_detect() {
if echo "$proxy" | egrep -q '(localhost|127\.0\.0\.[0-9]*):3142'; then
# set http_proxy for the initial debootstrap
export http_proxy="$proxy"
- local bridge_ip=$(ip -4 a show dev lxcbr0 | awk '/ inet / {sub(/\/.*$/, "", $2); print $2}') || true
- if [ -n "$bridge_ip" ]; then
- ADT_APT_PROXY="http://$bridge_ip:3142"
+
+ # translate proxy address to one that can be accessed from the
+ # running container
+ local bridge_interface=$(awk '{ if ($1 == "lxc.network.link") print($3)}' /etc/lxc/default.conf)
+ if [ -n "$bridge_interface" ]; then
+ local bridge_ip=$(ip -4 a show dev "$bridge_interface" | awk '/ inet / {sub(/\/.*$/, "", $2); print $2}') || true
+ if [ -n "$bridge_ip" ]; then
+ ADT_APT_PROXY="http://$bridge_ip:3142"
+ fi
+ fi
+ echo "Detected apt-cacher-ng. Using local proxy $http_proxy"
+ if [ -n "$ADT_APT_PROXY" ]; then
+ echo "Using $ADT_APT_PROXY as container proxy"
fi
- echo "Detected apt-cacher-ng. Using local proxy $http_proxy, container proxy $ADT_APT_PROXY"
fi
fi
}
--
2.6.2
More information about the autopkgtest-devel
mailing list