2014-01-16 01:02:28 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-10-15 05:00:18 +00:00
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 1 ]; then
|
2014-09-04 04:56:29 +00:00
|
|
|
set -x
|
|
|
|
fi
|
2014-01-16 01:02:28 +00:00
|
|
|
set -eu
|
2014-04-03 02:24:15 +00:00
|
|
|
set -o pipefail
|
2014-01-16 01:02:28 +00:00
|
|
|
|
|
|
|
DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-}
|
|
|
|
|
|
|
|
[ -n "$DIB_DISTRIBUTION_MIRROR" ] || exit 0
|
|
|
|
|
2018-10-15 05:00:18 +00:00
|
|
|
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
|