From 4d4417c9a68168c18e4f141eebb503914596e547 Mon Sep 17 00:00:00 2001 From: Mikhail S Medvedev Date: Wed, 22 Mar 2017 20:22:33 -0500 Subject: [PATCH] Use correct Ubuntu distro url on non-x86 arches diskimage-builder usually provides defaults that work out of the box. One default that does not work outside of x86 land is Ubuntu distro mirror url. Considering there are only two valid default options, we can automatically choose a better default. This patch changes behavior only for architectures known to be using http://ports.ubuntu.com/ubuntu-ports. All others still would use http://archive.ubuntu.com/ubuntu as default. It provides some guarantee that we do not introduce a regression. Change-Id: If95a64bac0c88f30736da4bae7f1fdce126c0bf6 --- .../environment.d/10-ubuntu-distro-name.bash | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/diskimage_builder/elements/ubuntu-minimal/environment.d/10-ubuntu-distro-name.bash b/diskimage_builder/elements/ubuntu-minimal/environment.d/10-ubuntu-distro-name.bash index 829952b3..065d62bb 100644 --- a/diskimage_builder/elements/ubuntu-minimal/environment.d/10-ubuntu-distro-name.bash +++ b/diskimage_builder/elements/ubuntu-minimal/environment.d/10-ubuntu-distro-name.bash @@ -5,4 +5,13 @@ export DIB_DEBIAN_COMPONENTS=${DIB_DEBIAN_COMPONENTS:-main,restricted,universe} if [ -n "${DIB_UBUNTU_DISTRIBUTION_MIRROR:-}" ]; then DIB_DISTRIBUTION_MIRROR=$DIB_UBUNTU_DISTRIBUTION_MIRROR fi -export DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-http://archive.ubuntu.com/ubuntu} + +# There are two default distro mirrors depending on architecture +ARCH=${ARCH:-} +if [[ "arm64 armhf powerpc ppc64el s390x" =~ "$ARCH" ]]; then + default_ubuntu_mirror=http://ports.ubuntu.com/ubuntu-ports +else + default_ubuntu_mirror=http://archive.ubuntu.com/ubuntu +fi + +export DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-$default_ubuntu_mirror}