From 6b46963acfab2d87ffe6c158b8bcd59e37eaac3a Mon Sep 17 00:00:00 2001 From: devrandom Date: Sun, 20 Mar 2011 17:43:01 -0700 Subject: [PATCH] properly handle the local host by using IP addresses --- bin/make-base-vm | 11 ++++++----- target-bin/bootstrap-fixup | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100755 target-bin/bootstrap-fixup diff --git a/bin/make-base-vm b/bin/make-base-vm index 407cf20..7844205 100755 --- a/bin/make-base-vm +++ b/bin/make-base-vm @@ -3,8 +3,8 @@ set -e SUITE=lucid ARCH=amd64 -MIRROR=http://${MIRROR_HOST:-10.0.2.2}:3142/archive.ubuntu.com/ubuntu -SECURITY_MIRROR=http://${MIRROR_HOST:-10.0.2.2}:3142/security.ubuntu.com/ubuntu +MIRROR=http://${MIRROR_HOST:-127.0.0.1}:3142/archive.ubuntu.com/ubuntu +SECURITY_MIRROR=http://${MIRROR_HOST:-127.0.0.1}:3142/security.ubuntu.com/ubuntu usage() { echo "Usage: ${0##*/} [OPTION]..." @@ -17,8 +17,9 @@ usage() { The MIRROR_HOST environment variable can be used to change the apt-cacher host. It should be something that the target VM can - resolve (not localhost). By default it is the IP address 10.0.2.2 - which is the host IP as visible from the guest. + resolve. It may be set to 127.0.0.1, in which case it will be + changed to 10.0.2.2 on the guest. 10.0.2.2 is the host IP as visible + from the guest under qemu networking. EOF } @@ -62,7 +63,7 @@ fi rm -rf $OUT -sudo vmbuilder kvm ubuntu --arch=$ARCH --suite=$SUITE --addpkg=openssh-server,pciutils,build-essential,git-core,subversion --ssh-key=var/id_dsa.pub --ssh-user-key=var/id_dsa.pub --mirror=$MIRROR --security-mirror=$SECURITY_MIRROR --dest=$OUT --flavour=virtual +sudo vmbuilder kvm ubuntu --arch=$ARCH --suite=$SUITE --addpkg=openssh-server,pciutils,build-essential,git-core,subversion --ssh-key=var/id_dsa.pub --ssh-user-key=var/id_dsa.pub --mirror=$MIRROR --security-mirror=$SECURITY_MIRROR --dest=$OUT --flavour=virtual --firstboot=`pwd`/target-bin/bootstrap-fixup mv $OUT/*.qcow2 $OUT.qcow2 diff --git a/target-bin/bootstrap-fixup b/target-bin/bootstrap-fixup new file mode 100755 index 0000000..9340f05 --- /dev/null +++ b/target-bin/bootstrap-fixup @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +sed -i -e 's/127.0.0.1:/10.0.2.2:/' $1/etc/apt/sources.list