c47ee6e121
When using the upstream cloud images with the "ubuntu" element, they have universe and multiverse enabled which we don't mirror. To use the infra mirrors as a DIB_DISTRIBUTION_MIRROR with this element, we need to be able to skip redirecting to universe and multiverse, and additionally enable insecure repos (as we don't gpg sign our mirrors). Add and document two new variables with the ubuntu element to do this. This is then setup by the openstack-ci-mirrors element so that we use local mirrors duing dib functional testing for the "ubuntu" element. Change-Id: I6ffbde07fa0e103641ee5c5f9d9e854e5b2168dc
31 lines
939 B
Bash
Executable File
31 lines
939 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 1 ]; then
|
|
set -x
|
|
fi
|
|
set -eu
|
|
set -o pipefail
|
|
|
|
DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-}
|
|
|
|
[ -n "$DIB_DISTRIBUTION_MIRROR" ] || exit 0
|
|
|
|
while IFS= read line
|
|
do
|
|
if [[ "$line" =~ "${DIB_DISTRIBUTION_MIRROR_UBUNTU_IGNORE:-}" ]]; then
|
|
# append line unmodified
|
|
echo "$line" | tee --append /etc/apt/sources.list.new
|
|
else
|
|
echo "$line" | \
|
|
sed -e "s&http://\(archive\|security\).ubuntu.com/ubuntu&$DIB_DISTRIBUTION_MIRROR&" | \
|
|
tee --append /etc/apt/sources.list.new
|
|
fi
|
|
done < /etc/apt/sources.list
|
|
|
|
if [[ -n "${DIB_DISTRIBUTION_MIRROR_UBUNTU_INSECURE:-}" ]]; then
|
|
echo "APT::Get::AllowUnauthenticated \"true\";" | tee /etc/apt/apt.conf.d/95allow-unauthenticated
|
|
echo "Acquire::AllowInsecureRepositories \"true\";" | tee -a /etc/apt/apt.conf.d/95allow-unauthenticated
|
|
fi
|
|
|
|
mv /etc/apt/sources.list.new /etc/apt/sources.list
|