mount: add mountOpt to mount/mount rc

This commit is contained in:
Nick Craig-Wood 2020-07-23 17:20:55 +01:00
parent 0272a7f405
commit 3c1c6d2f01
1 changed files with 10 additions and 3 deletions

View File

@ -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)