From d2c5a46fcf197cad949b4cad5dd9e65100a7a133 Mon Sep 17 00:00:00 2001 From: Mikhail Koliada <88318005+mikhailkoliada@users.noreply.github.com> Date: Sun, 19 Dec 2021 17:19:29 +0300 Subject: [PATCH] [Ubuntu] put snapd auto refresh on hold (#4768) --- images/linux/scripts/base/snap.sh | 8 ++++++++ images/linux/ubuntu1804.json | 5 +++++ images/linux/ubuntu2004.json | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 images/linux/scripts/base/snap.sh diff --git a/images/linux/scripts/base/snap.sh b/images/linux/scripts/base/snap.sh new file mode 100644 index 000000000..98163745b --- /dev/null +++ b/images/linux/scripts/base/snap.sh @@ -0,0 +1,8 @@ +#!/bin/bash -e + +# Put snapd auto refresh on hold +# as it may generate too much traffic on Canonical's snap server +# when they are rolling a new major update out. +# Hold is calculated as today's date + 60 days + +snap set system refresh.hold="$(date --date='today+60 days' +%Y-%m-%dT%H:%M:%S%:z)" diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index bff0b4597..38a0c266f 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -316,6 +316,11 @@ "script": "{{template_dir}}/scripts/base/apt-mock-remove.sh", "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "script": "{{template_dir}}/scripts/base/snap.sh", + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "inline": [ diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 4d7af50f0..eb9e9e613 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -317,6 +317,11 @@ "script": "{{template_dir}}/scripts/base/apt-mock-remove.sh", "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "script": "{{template_dir}}/scripts/base/snap.sh", + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "inline": [