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

mount: add mountOpt to mount/mount rc

Nick Craig-Wood3c1c6d2f01e1
diff --git a/cmd/mountlib/rc.go b/cmd/mountlib/rc.go
index 34128d8d1..cbcfc889b 100644
--- a/cmd/mountlib/rc.go
+++ b/cmd/mountlib/rc.go
@@ -55,16 +55,17 @@ This takes the following parameters
- fs - a remote path to be mounted (required)
- mountPoint: valid path on the local machine (required)
- mountType: One of the values (mount, cmount, mount2) specifies the mount implementation to use
+- mountOpt: a JSON object with Mount options in.
- vfsOpt: a JSON object with VFS options in.
Eg
rclone rc mount/mount fs=mydrive: mountPoint=/home/<user>/mountPoint
rclone rc mount/mount fs=mydrive: mountPoint=/home/<user>/mountPoint mountType=mount
- rclone rc mount/mount fs=TestDrive: mountPoint=/mnt/tmp vfsOpt='{"CacheMode": 2}'
+ rclone rc mount/mount fs=TestDrive: mountPoint=/mnt/tmp vfsOpt='{"CacheMode": 2}' mountOpt='{"AllowOther": true}'
The vfsOpt are as described in options/get and can be seen in the the
-"vfs" section when running:
+"vfs" section when running and the mountOpt can be seen in the "mount" section.
rclone rc options/get
`,
@@ -84,6 +85,12 @@ func mountRc(_ context.Context, in rc.Params) (out rc.Params, err error) {
return nil, err
}
+ opt := Opt
+ err = in.GetStructMissingOK("mountOpt", &opt)
+ if err != nil {
+ return nil, err
+ }
+
mountType, err := in.GetString("mountType")
mountMu.Lock()
@@ -107,7 +114,7 @@ func mountRc(_ context.Context, in rc.Params) (out rc.Params, err error) {
if mountFns[mountType] != nil {
VFS := vfs.New(fdst, &vfsOpt)
- _, unmountFn, err := mountFns[mountType](VFS, mountPoint, &Opt)
+ _, unmountFn, err := mountFns[mountType](VFS, mountPoint, &opt)
if err != nil {
log.Printf("mount FAILED: %v", err)