Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

selfupdate: dont detect FUSE if build is static

Ivan Andreev93353c431b3a
diff --git a/cmd/cmount/mount.go b/cmd/cmount/mount.go
index d9c21edf6..dd30f35ea 100644
--- a/cmd/cmount/mount.go
+++ b/cmd/cmount/mount.go
@@ -21,6 +21,7 @@ import (
"github.com/rclone/rclone/cmd/mountlib"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/lib/atexit"
+ "github.com/rclone/rclone/lib/buildinfo"
"github.com/rclone/rclone/vfs"
)
@@ -35,6 +36,7 @@ func init() {
cmd.Aliases = append(cmd.Aliases, "cmount")
}
mountlib.AddRc("cmount", mount)
+ buildinfo.Tags = append(buildinfo.Tags, "cmount")
}
// Find the option string in the current options
diff --git a/cmd/selfupdate/help.go b/cmd/selfupdate/help.go
index 73fcdb45f..791f20d42 100644
--- a/cmd/selfupdate/help.go
+++ b/cmd/selfupdate/help.go
@@ -27,7 +27,7 @@ If the old version contains only dots and digits (for example |v1.54.0|)
then it's a stable release so you won't need the |--beta| flag. Beta releases
have an additional information similar to |v1.54.0-beta.5111.06f1c0c61|.
(if you are a developer and use a locally built rclone, the version number
-will end with |-DEV|, you will have to rebuild it as it obvisously can't
+will end with |-DEV|, you will have to rebuild it as it obviously can't
be distributed).
If you previously installed rclone via a package manager, the package may
diff --git a/cmd/selfupdate/selfupdate.go b/cmd/selfupdate/selfupdate.go
index 3e2988935..bc48f0413 100644
--- a/cmd/selfupdate/selfupdate.go
+++ b/cmd/selfupdate/selfupdate.go
@@ -143,14 +143,9 @@ func InstallUpdate(ctx context.Context, opt *Options) error {
return errors.New("--stable and --beta are mutually exclusive")
}
- gotCmount := false
- for _, tag := range buildinfo.Tags {
- if tag == "cmount" {
- gotCmount = true
- break
- }
- }
- if gotCmount && !cmount.ProvidedBy(runtime.GOOS) {
+ // The `cmount` tag is added by cmd/cmount/mount.go only if build is static.
+ _, tags := buildinfo.GetLinkingAndTags()
+ if strings.Contains(" "+tags+" ", " cmount ") && !cmount.ProvidedBy(runtime.GOOS) {
return errors.New("updating would discard the mount FUSE capability, aborting")
}
diff --git a/lib/buildinfo/cmount.go b/lib/buildinfo/cmount.go
deleted file mode 100644
index 67ffbbea5..000000000
--- a/lib/buildinfo/cmount.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build cmount
-
-package buildinfo
-
-func init() {
- Tags = append(Tags, "cmount")
-}
diff --git a/lib/buildinfo/tags.go b/lib/buildinfo/tags.go
index 84b79bd19..2982d7630 100644
--- a/lib/buildinfo/tags.go
+++ b/lib/buildinfo/tags.go
@@ -6,6 +6,8 @@ import (
)
// Tags contains slice of build tags
+// The `cmount` tag is added by cmd/cmount/mount.go only if build is static.
+// Other tags including `cgo` are detected in this package.
var Tags []string
// GetLinkingAndTags tells how the rclone executable was linked