selfupdate: abort if updating would discard fuse semantics
This commit is contained in:
parent
ef5c212f9b
commit
1fe2460e38
4 changed files with 25 additions and 1 deletions
7
cmd/cmount/arch.go
Normal file
7
cmd/cmount/arch.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package cmount
|
||||
|
||||
// ProvidedBy returns true if the rclone build for the given OS
|
||||
// provides support for lib/cgo-fuse
|
||||
func ProvidedBy(osName string) bool {
|
||||
return osName == "windows" || osName == "darwin"
|
||||
}
|
|
@ -26,7 +26,7 @@ import (
|
|||
|
||||
func init() {
|
||||
name := "cmount"
|
||||
cmountOnly := runtime.GOOS == "windows" || runtime.GOOS == "darwin"
|
||||
cmountOnly := ProvidedBy(runtime.GOOS)
|
||||
if cmountOnly {
|
||||
name = "mount"
|
||||
}
|
||||
|
|
|
@ -37,6 +37,10 @@ your OS) to update these too. This command with the default |--package zip|
|
|||
will update only the rclone executable so the local manual may become
|
||||
inaccurate after it.
|
||||
|
||||
The |rclone mount| command (https://rclone.org/commands/rclone_mount/) may
|
||||
or may not support extended FUSE options depending on the build and OS.
|
||||
|selfupdate| will refuse to update if the capability would be discarded.
|
||||
|
||||
Note: Windows forbids deletion of a currently running executable so this
|
||||
command will rename the old executable to 'rclone.old.exe' upon success.
|
||||
|
||||
|
|
|
@ -21,9 +21,11 @@ import (
|
|||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rclone/rclone/cmd"
|
||||
"github.com/rclone/rclone/cmd/cmount"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/config/flags"
|
||||
"github.com/rclone/rclone/fs/fshttp"
|
||||
"github.com/rclone/rclone/lib/buildinfo"
|
||||
"github.com/rclone/rclone/lib/random"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
|
@ -141,6 +143,17 @@ 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) {
|
||||
return errors.New("updating would discard the mount FUSE capability, aborting")
|
||||
}
|
||||
|
||||
newVersion, siteURL, err := GetVersion(ctx, opt.Beta, opt.Version)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "unable to detect new version")
|
||||
|
|
Loading…
Reference in a new issue