From 035dc70f77d4353de9fbacd66be4f0797d4d9f62 Mon Sep 17 00:00:00 2001 From: sergei-pyshnoi <121864472+sergei-pyshnoi@users.noreply.github.com> Date: Mon, 29 May 2023 13:32:19 +0200 Subject: [PATCH] [Ubuntu] Add archive.ubuntu.com to sources.list (#7616) --- images/linux/scripts/base/apt-ubuntu-archive.sh | 12 ++++++++++++ images/linux/ubuntu2004.json | 8 ++++++++ images/linux/ubuntu2204.pkr.hcl | 6 ++++++ 3 files changed, 26 insertions(+) create mode 100644 images/linux/scripts/base/apt-ubuntu-archive.sh diff --git a/images/linux/scripts/base/apt-ubuntu-archive.sh b/images/linux/scripts/base/apt-ubuntu-archive.sh new file mode 100644 index 000000000..0f1b0fa88 --- /dev/null +++ b/images/linux/scripts/base/apt-ubuntu-archive.sh @@ -0,0 +1,12 @@ +#!/bin/bash -e +################################################################################ +## File: apt-ubuntu-archive.sh +## Desc: Script for adding additional apt repo to /etc/apt/sources.list +################################################################################ + +echo "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted" | tee -a /etc/apt/sources.list +echo "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates main restricted" | tee -a /etc/apt/sources.list + +echo "deb http://security.ubuntu.com/ubuntu/ $(lsb_release -cs)-security main restricted" | tee -a /etc/apt/sources.list +echo "deb http://security.ubuntu.com/ubuntu/ $(lsb_release -cs)-security universe" | tee -a /etc/apt/sources.list +echo "deb http://security.ubuntu.com/ubuntu/ $(lsb_release -cs)-security multiverse" | tee -a /etc/apt/sources.list diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index b1439dbce..e89da3bb7 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -90,6 +90,14 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "script": "{{template_dir}}/scripts/base/apt-ubuntu-archive.sh", + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "script": "{{template_dir}}/scripts/base/limits.sh", diff --git a/images/linux/ubuntu2204.pkr.hcl b/images/linux/ubuntu2204.pkr.hcl index d9da88175..722562314 100644 --- a/images/linux/ubuntu2204.pkr.hcl +++ b/images/linux/ubuntu2204.pkr.hcl @@ -198,6 +198,12 @@ build { scripts = ["${path.root}/scripts/base/repos.sh"] } + provisioner "shell" { + environment_vars = ["DEBIAN_FRONTEND=noninteractive"] + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + scripts = ["${path.root}/scripts/base/apt-ubuntu-archive.sh"] + } + provisioner "shell" { environment_vars = ["DEBIAN_FRONTEND=noninteractive"] execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"