Allow use of mirrors when building Ubuntu images

Add a script to ubuntu's pre-install.d that will change
archive.ubuntu.com to a mirror specified in $DIB_DISTRIBUTION_MIRROR.

Change-Id: Idfd5a40ec8a1912a5de5dcdcaf9795946b0b53b8
This commit is contained in:
Steve Kowalik 2014-01-16 12:02:28 +11:00
parent d0fd8915f6
commit 48f5359efb
2 changed files with 12 additions and 0 deletions

View File

@ -6,3 +6,5 @@ Overrides:
use the environment variable DIB\_CLOUD\_IMAGES
* To download a non-default release of Ubuntu cloud images, use the
environment variable DIB\_RELEASE
* To use a different mirror rather than archive.ubuntu.com, use the
environment variable DIB\_DISTRIBUTION\_MIRROR

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -eu
DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-}
[ -n "$DIB_DISTRIBUTION_MIRROR" ] || exit 0
sudo sed -ie "s&http://archive.ubuntu.com/ubuntu&$DIB_DISTRIBUTION_MIRROR&" \
/etc/apt/sources.list