[ubuntu] Update apt sources (#8075)

This commit is contained in:
Shamil Mubarakshin
2023-08-11 14:30:33 +02:00
committed by GitHub
parent d2c69950ce
commit 7fa63e2b95
2 changed files with 11 additions and 8 deletions

View File

@@ -1,12 +1,15 @@
#!/bin/bash -e
################################################################################
## File: apt-ubuntu-archive.sh
## Desc: Script for adding additional apt repo to /etc/apt/sources.list and /etc/cloud/templates/sources.list.ubuntu.tmpl
## Desc: Script for configuring apt sources. https://manpages.ubuntu.com/manpages/jammy/en/man1/apt-transport-mirror.1.html
################################################################################
echo "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted" | tee -a /etc/apt/sources.list /etc/cloud/templates/sources.list.ubuntu.tmpl
echo "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates main restricted" | tee -a /etc/apt/sources.list /etc/cloud/templates/sources.list.ubuntu.tmpl
touch /etc/apt/apt-mirrors.txt
echo "deb http://security.ubuntu.com/ubuntu/ $(lsb_release -cs)-security main restricted" | tee -a /etc/apt/sources.list /etc/cloud/templates/sources.list.ubuntu.tmpl
echo "deb http://security.ubuntu.com/ubuntu/ $(lsb_release -cs)-security universe" | tee -a /etc/apt/sources.list /etc/cloud/templates/sources.list.ubuntu.tmpl
echo "deb http://security.ubuntu.com/ubuntu/ $(lsb_release -cs)-security multiverse" | tee -a /etc/apt/sources.list /etc/cloud/templates/sources.list.ubuntu.tmpl
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
cp -f /etc/apt/sources.list /etc/cloud/templates/sources.list.ubuntu.tmpl

View File

@@ -84,7 +84,7 @@
},
{
"type": "shell",
"script": "{{template_dir}}/scripts/base/apt.sh",
"script": "{{template_dir}}/scripts/base/apt-ubuntu-archive.sh",
"environment_vars": [
"DEBIAN_FRONTEND=noninteractive"
],
@@ -92,7 +92,7 @@
},
{
"type": "shell",
"script": "{{template_dir}}/scripts/base/apt-ubuntu-archive.sh",
"script": "{{template_dir}}/scripts/base/apt.sh",
"environment_vars": [
"DEBIAN_FRONTEND=noninteractive"
],