Skip to content

Commit

Permalink
[Ubuntu24] Update apt sources (actions#10804)
Browse files Browse the repository at this point in the history
  • Loading branch information
shamil-mubarakshin authored Nov 4, 2024
1 parent 2d27578 commit bf6ac0d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions images/ubuntu/scripts/build/configure-apt-sources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@
## 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 "http://archive.ubuntu.com/ubuntu/\tpriority:2\n" | tee -a /etc/apt/apt-mirrors.txt
printf "http://security.ubuntu.com/ubuntu/\tpriority:3\n" | tee -a /etc/apt/apt-mirrors.txt

sed -i 's/http:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/apt-mirrors.txt/' /etc/apt/sources.list
if is_ubuntu24; then
sed -i 's/http:\/\/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/http:\/\/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
# Apt changes to survive Cloud Init
cp -f /etc/apt/sources.list /etc/cloud/templates/sources.list.ubuntu.tmpl
fi

0 comments on commit bf6ac0d

Please sign in to comment.