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 }}'"