Files
runner-images/images/ubuntu/scripts/build/configure-apt-sources.sh
Subir Ghosh fd1af56b4f Change URL for packages (#11997)
* fix:URL for packages

* chore Add co-author
>
> Co-authored-by: greg dryke <no-reply@github.com>

* chore: Incorporate Review comments

* fix: remove redundant initialization
2025-04-11 11:53:08 -06:00

26 lines
1.2 KiB
Bash

#!/bin/bash -e
################################################################################
## File: configure-apt-sources.sh
## Desc: Configure apt sources with failover from Azure to Ubuntu archives.
################################################################################
source $HELPER_SCRIPTS/os.sh
touch /etc/apt/apt-mirrors.txt
printf "http://azure.archive.ubuntu.com/ubuntu/\tpriority:1\n" | tee -a /etc/apt/apt-mirrors.txt
printf "https://archive.ubuntu.com/ubuntu/\tpriority:2\n" | tee -a /etc/apt/apt-mirrors.txt
printf "https://security.ubuntu.com/ubuntu/\tpriority:3\n" | tee -a /etc/apt/apt-mirrors.txt
if is_ubuntu24; then
sed -i 's/https:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/apt-mirrors.txt/' /etc/apt/sources.list.d/ubuntu.sources
# Apt changes to survive Cloud Init
cp -f /etc/apt/sources.list.d/ubuntu.sources /etc/cloud/templates/sources.list.ubuntu.deb822.tmpl
else
sed -i 's/https:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/apt-mirrors.txt/' /etc/apt/sources.list
# Apt changes to survive Cloud Init
cp -f /etc/apt/sources.list /etc/cloud/templates/sources.list.ubuntu.tmpl
fi