"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
build: add build tag noselfupdate
Ivan Andreev9eab258ffbb6
diff --git a/cmd/cmd.go b/cmd/cmd.goindex e2a03db5d..637b91b39 100644--- a/cmd/cmd.go+++ b/cmd/cmd.go@@ -553,7 +553,7 @@ func Main() {setupRootCommand(Root)AddBackendFlags()if err := Root.Execute(); err != nil {- if strings.HasPrefix(err.Error(), "unknown command") {+ if strings.HasPrefix(err.Error(), "unknown command") && selfupdateEnabled {Root.PrintErrf("You could use '%s selfupdate' to get latest features.\n\n", Root.CommandPath())}log.Fatalf("Fatal error: %v", err)diff --git a/cmd/selfupdate/help.go b/cmd/selfupdate/help.goindex 791f20d42..fe9a63158 100644--- a/cmd/selfupdate/help.go+++ b/cmd/selfupdate/help.go@@ -1,3 +1,5 @@+// +build !noselfupdate+package selfupdate// Note: "|" will be replaced by backticks in the help string belowdiff --git a/cmd/selfupdate/noselfupdate.go b/cmd/selfupdate/noselfupdate.gonew file mode 100644index 000000000..41afd1c94--- /dev/null+++ b/cmd/selfupdate/noselfupdate.go@@ -0,0 +1,11 @@+// +build noselfupdate++package selfupdate++import (+ "github.com/rclone/rclone/lib/buildinfo"+)++func init() {+ buildinfo.Tags = append(buildinfo.Tags, "noselfupdate")+}diff --git a/cmd/selfupdate/selfupdate.go b/cmd/selfupdate/selfupdate.goindex bc48f0413..1789b9cb7 100644--- a/cmd/selfupdate/selfupdate.go+++ b/cmd/selfupdate/selfupdate.go@@ -1,3 +1,5 @@+// +build !noselfupdate+package selfupdateimport (diff --git a/cmd/selfupdate/selfupdate_test.go b/cmd/selfupdate/selfupdate_test.goindex 567643716..a9a889ba7 100644--- a/cmd/selfupdate/selfupdate_test.go+++ b/cmd/selfupdate/selfupdate_test.go@@ -1,3 +1,5 @@+// +build !noselfupdate+package selfupdateimport (diff --git a/cmd/selfupdate/verify.go b/cmd/selfupdate/verify.goindex 115119fed..0c135c75c 100644--- a/cmd/selfupdate/verify.go+++ b/cmd/selfupdate/verify.go@@ -1,3 +1,5 @@+// +build !noselfupdate+package selfupdateimport (diff --git a/cmd/selfupdate/writable_unix.go b/cmd/selfupdate/writable_unix.goindex f7c8a59fb..30cb8a9bf 100644--- a/cmd/selfupdate/writable_unix.go+++ b/cmd/selfupdate/writable_unix.go@@ -1,4 +1,5 @@// +build !windows,!plan9,!js+// +build !noselfupdatepackage selfupdatediff --git a/cmd/selfupdate/writable_unsupported.go b/cmd/selfupdate/writable_unsupported.goindex 40f1d2429..bc68073d6 100644--- a/cmd/selfupdate/writable_unsupported.go+++ b/cmd/selfupdate/writable_unsupported.go@@ -1,4 +1,5 @@// +build plan9 js+// +build !noselfupdatepackage selfupdatediff --git a/cmd/selfupdate/writable_windows.go b/cmd/selfupdate/writable_windows.goindex 8270d3936..7e23f56dc 100644--- a/cmd/selfupdate/writable_windows.go+++ b/cmd/selfupdate/writable_windows.go@@ -1,4 +1,5 @@// +build windows+// +build !noselfupdatepackage selfupdatediff --git a/cmd/selfupdate_disabled.go b/cmd/selfupdate_disabled.gonew file mode 100644index 000000000..3d666700b--- /dev/null+++ b/cmd/selfupdate_disabled.go@@ -0,0 +1,5 @@+// +build noselfupdate++package cmd++const selfupdateEnabled = falsediff --git a/cmd/selfupdate_enabled.go b/cmd/selfupdate_enabled.gonew file mode 100644index 000000000..5ee10354a--- /dev/null+++ b/cmd/selfupdate_enabled.go@@ -0,0 +1,7 @@+// +build !noselfupdate++package cmd++// This constant must be in the `cmd` package rather than `cmd/selfupdate`+// to prevent build failure due to dependency loop.+const selfupdateEnabled = truediff --git a/lib/buildinfo/tags.go b/lib/buildinfo/tags.goindex 2982d7630..6e61a457d 100644--- a/lib/buildinfo/tags.go+++ b/lib/buildinfo/tags.go@@ -5,8 +5,9 @@ import ("strings")-// Tags contains slice of build tags+// Tags contains slice of build tags.// The `cmount` tag is added by cmd/cmount/mount.go only if build is static.+// The `noselfupdate` tag is added by cmd/selfupdate/noselfupdate.go// Other tags including `cgo` are detected in this package.var Tags []string