mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
mount: make mount/mount remote control take vfsOpt option
See: https://forum.rclone.org/t/passing-mount-options-like-vfs-cache-mode-when-using-rclone-rc-mount-mount/17863
This commit is contained in:
@@ -55,11 +55,18 @@ 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
|
||||
- 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}'
|
||||
|
||||
The vfsOpt are as described in options/get and can be seen in the the
|
||||
"vfs" section when running:
|
||||
|
||||
rclone rc options/get
|
||||
`,
|
||||
})
|
||||
}
|
||||
@@ -71,6 +78,12 @@ func mountRc(_ context.Context, in rc.Params) (out rc.Params, err error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
vfsOpt := vfsflags.Opt
|
||||
err = in.GetStructMissingOK("vfsOpt", &vfsOpt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
mountType, err := in.GetString("mountType")
|
||||
|
||||
mountMu.Lock()
|
||||
@@ -93,7 +106,7 @@ func mountRc(_ context.Context, in rc.Params) (out rc.Params, err error) {
|
||||
}
|
||||
|
||||
if mountFns[mountType] != nil {
|
||||
VFS := vfs.New(fdst, &vfsflags.Opt)
|
||||
VFS := vfs.New(fdst, &vfsOpt)
|
||||
_, unmountFn, err := mountFns[mountType](VFS, mountPoint)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user