diff --git a/images/linux/scripts/base/snap.sh b/images/linux/scripts/base/snap.sh new file mode 100644 index 00000000..98163745 --- /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 bff0b459..38a0c266 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 4d7af50f..eb9e9e61 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": [