fs: make --links flag global and add new --local-links and --vfs-links flag
Before this change the --links flag when using the VFS override the --links flag for the local backend which meant the local backend needed explicit config to use links. This fixes the problem by making the --links flag global and adding a new --local-links flag and --vfs-links flags to control the features individually if required.
This commit is contained in:
+10
-5
@@ -305,10 +305,11 @@ modified files from the cache (the related global flag `--checkers` has no effec
|
||||
|
||||
### Symlinks
|
||||
|
||||
Be default the VFS does not support symlinks. However this may be
|
||||
enabled with the following flag:
|
||||
By default the VFS does not support symlinks. However this may be
|
||||
enabled with either of the following flags:
|
||||
|
||||
--links Translate symlinks to/from regular files with a '.rclonelink' extension.
|
||||
--links Translate symlinks to/from regular files with a '.rclonelink' extension.
|
||||
--vfs-links Translate symlinks to/from regular files with a '.rclonelink' extension for the VFS
|
||||
|
||||
As most cloud storage systems do not support symlinks directly, rclone
|
||||
stores the symlink as a normal file with a special extension. So a
|
||||
@@ -316,9 +317,13 @@ file which appears as a symlink `link-to-file.txt` would be stored on
|
||||
cloud storage as `link-to-file.txt.rclonelink` and the contents would
|
||||
be the path to the symlink destination.
|
||||
|
||||
This scheme is compatible with that used by the [local backend with the --links flag](/local/#symlinks-junction-points).
|
||||
Note that `--links` enables symlink translation globally in rclone -
|
||||
this includes any backend which supports the concept (for example the
|
||||
local backend). `--vfs-links` just enables it for the VFS layer.
|
||||
|
||||
The `--links` flag has been designed for `rclone mount`, `rclone
|
||||
This scheme is compatible with that used by the [local backend with the --local-links flag](/local/#symlinks-junction-points).
|
||||
|
||||
The `--vfs-links` flag has been designed for `rclone mount`, `rclone
|
||||
nfsmount` and `rclone serve nfs`.
|
||||
|
||||
It hasn't been tested with the other `rclone serve` commands yet.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package vfscommon
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
@@ -45,11 +46,10 @@ var OptionsInfo = fs.Options{{
|
||||
Help: "Only allow read-only access",
|
||||
Groups: "VFS",
|
||||
}, {
|
||||
Name: "links",
|
||||
Default: false,
|
||||
Help: "Translate symlinks to/from regular files with a '" + fs.LinkSuffix + "' extension",
|
||||
Groups: "VFS",
|
||||
ShortOpt: "l",
|
||||
Name: "vfs_links",
|
||||
Default: false,
|
||||
Help: "Translate symlinks to/from regular files with a '" + fs.LinkSuffix + "' extension for the VFS",
|
||||
Groups: "VFS",
|
||||
}, {
|
||||
Name: "vfs_cache_mode",
|
||||
Default: CacheModeOff,
|
||||
@@ -176,7 +176,7 @@ type Options struct {
|
||||
NoSeek bool `config:"no_seek"` // don't allow seeking if set
|
||||
NoChecksum bool `config:"no_checksum"` // don't check checksums if set
|
||||
ReadOnly bool `config:"read_only"` // if set VFS is read only
|
||||
Links bool `config:"links"` // if set interpret link files
|
||||
Links bool `config:"vfs_links"` // if set interpret link files
|
||||
NoModTime bool `config:"no_modtime"` // don't read mod times for files
|
||||
DirCacheTime fs.Duration `config:"dir_cache_time"` // how long to consider directory listing cache valid
|
||||
Refresh bool `config:"vfs_refresh"` // refreshes the directory listing recursively on start
|
||||
@@ -211,6 +211,13 @@ var Opt Options
|
||||
|
||||
// Init the options, making sure everything is within range
|
||||
func (opt *Options) Init() {
|
||||
ci := fs.GetConfig(context.Background())
|
||||
|
||||
// Override --vfs-links with --links if set
|
||||
if ci.Links {
|
||||
opt.Links = true
|
||||
}
|
||||
|
||||
// Mask the permissions with the umask
|
||||
opt.DirPerms &= ^opt.Umask
|
||||
opt.FilePerms &= ^opt.Umask
|
||||
|
||||
Reference in New Issue
Block a user