Un-hardcode host/guest IP
I was running into trouble using gitian LXC INSIDE a VirtualBox VM, because the 10.0.2.x IP range overlaps with the range that VirtualBox uses for its internal NAT network. This commit makes it possible to override the host and guest IP that is used during LXC image creation and the build, using environment variables: - `GITIAN_HOST_IP` (default=10.0.2.2, host IP from the viewpoint of the VM, can be used for both LXC and KVM) - `LXC_GUEST_IP` (default=10.0.2.5, guest IP from the viewpoint of the host, effective for LXC only) When these are not defined the behavior remains the same as before.lxc
parent
c9e62adc21
commit
5785dfc3ae
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
wd=`pwd`
|
||||
|
||||
# Default host IP is 10.0.2.2
|
||||
if [ -z "$GITIAN_HOST_IP" ]; then
|
||||
GITIAN_HOST_IP=10.0.2.2
|
||||
fi
|
||||
|
||||
# Default to host IP if the MIRROR_HOST is not set, or set to 127.0.0.1
|
||||
if [ -z "$MIRROR_HOST" ] || [ "$MIRROR_HOST" == "127.0.0.1" ]; then
|
||||
MIRROR_HOST=$GITIAN_HOST_IP
|
||||
fi
|
||||
|
||||
sed "s;HOSTIP;$MIRROR_HOST;g" < target-bin/bootstrap-fixup.in > target-bin/bootstrap-fixup
|
@ -1,4 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
wd=`pwd`
|
||||
sed "s;ROOTFS;$wd/target-$LXC_SUITE-$LXC_ARCH;;s;ARCH;$LXC_ARCH;g" < etc/lxc.config.in > var/lxc.config
|
||||
|
||||
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
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
. /etc/lsb-release
|
||||
|
||||
echo "deb http://10.0.2.2:3142/archive.ubuntu.com/ubuntu $DISTRIB_CODENAME main universe" > $1/etc/apt/sources.list
|
||||
echo "deb http://10.0.2.2:3142/archive.ubuntu.com/ubuntu $DISTRIB_CODENAME-updates main universe" >> $1/etc/apt/sources.list
|
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
. /etc/lsb-release
|
||||
|
||||
echo "deb http://HOSTIP:3142/archive.ubuntu.com/ubuntu $DISTRIB_CODENAME main universe" > $1/etc/apt/sources.list
|
||||
echo "deb http://HOSTIP:3142/archive.ubuntu.com/ubuntu $DISTRIB_CODENAME-updates main universe" >> $1/etc/apt/sources.list
|
Loading…
Reference in New Issue