Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thimslugga/9daf3748cee479613672651bf97464ba to your computer and use it in GitHub Desktop.
Save thimslugga/9daf3748cee479613672651bf97464ba to your computer and use it in GitHub Desktop.
Give users control over snapd autorefresh mechanism - apply patch over offiical repo and build binaries
diff --git a/cmd/snapd/main.go b/cmd/snapd/main.go
index 741d998404..55d06d2d9c 100644
--- a/cmd/snapd/main.go
+++ b/cmd/snapd/main.go
@@ -52,6 +52,10 @@ func init() {
}
func main() {
+ if _, found := os.LookupEnv("SNAPD_DISABLE_AUTOREFRESH"); found {
+ logger.Noticef("AutoRefresh disabled due to SNAPD_DISABLE_AUTOREFRESH environment variable being set")
+ }
+
// When preseeding re-exec is not used
if snapdenv.Preseeding() {
logger.Noticef("running for preseeding")
diff --git a/overlord/snapstate/autorefresh.go b/overlord/snapstate/autorefresh.go
index 7faed91d6c..51e1d5405d 100644
--- a/overlord/snapstate/autorefresh.go
+++ b/overlord/snapstate/autorefresh.go
@@ -327,6 +327,11 @@ func (m *autoRefresh) Ensure() error {
return err
}
+ if _, found := os.LookupEnv("SNAPD_DISABLE_AUTOREFRESH"); found {
+ logger.Noticef("AutoRefresh disabled due to SNAPD_DISABLE_AUTOREFRESH environment variable being set")
+ held = true
+ }
+
// do refresh attempt (if needed)
if !held {
if !holdTime.IsZero() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment