Merge branch 'rclone:master' into mct-install-set-modes-mac

This commit is contained in:
Michael C Tiernan - MIT-Research Computing Project 2022-05-19 16:48:05 -04:00 committed by GitHub
commit f657bdb86b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 13 deletions

View File

@ -301,6 +301,9 @@ func init() {
}, { }, {
Value: "fr-par", Value: "fr-par",
Help: "Paris, France", Help: "Paris, France",
}, {
Value: "pl-waw",
Help: "Warsaw, Poland",
}}, }},
}, { }, {
Name: "region", Name: "region",
@ -715,6 +718,9 @@ func init() {
}, { }, {
Value: "s3.fr-par.scw.cloud", Value: "s3.fr-par.scw.cloud",
Help: "Paris Endpoint", Help: "Paris Endpoint",
}, {
Value: "s3.pl-waw.scw.cloud",
Help: "Warsaw Endpoint",
}}, }},
}, { }, {
Name: "endpoint", Name: "endpoint",

View File

@ -141,22 +141,20 @@ func (f *Fs) Hashes() hash.Set {
return f.hashSet return f.hashSet
} }
// Mkdir makes the root directory of the Fs object // mkdir makes the directory passed in and returns the upstreams used
func (f *Fs) Mkdir(ctx context.Context, dir string) error { func (f *Fs) mkdir(ctx context.Context, dir string) ([]*upstream.Fs, error) {
upstreams, err := f.create(ctx, dir) upstreams, err := f.create(ctx, dir)
if err == fs.ErrorObjectNotFound { if err == fs.ErrorObjectNotFound {
if dir != parentDir(dir) { parent := parentDir(dir)
if err := f.Mkdir(ctx, parentDir(dir)); err != nil { if dir != parent {
return err upstreams, err = f.mkdir(ctx, parent)
}
upstreams, err = f.create(ctx, dir)
} else if dir == "" { } else if dir == "" {
// If root dirs not created then create them // If root dirs not created then create them
upstreams, err = f.upstreams, nil upstreams, err = f.upstreams, nil
} }
} }
if err != nil { if err != nil {
return err return nil, err
} }
errs := Errors(make([]error, len(upstreams))) errs := Errors(make([]error, len(upstreams)))
multithread(len(upstreams), func(i int) { multithread(len(upstreams), func(i int) {
@ -165,7 +163,17 @@ func (f *Fs) Mkdir(ctx context.Context, dir string) error {
errs[i] = fmt.Errorf("%s: %w", upstreams[i].Name(), err) errs[i] = fmt.Errorf("%s: %w", upstreams[i].Name(), err)
} }
}) })
return errs.Err() err = errs.Err()
if err != nil {
return nil, err
}
return upstreams, nil
}
// Mkdir makes the root directory of the Fs object
func (f *Fs) Mkdir(ctx context.Context, dir string) error {
_, err := f.mkdir(ctx, dir)
return err
} }
// Purge all files in the directory // Purge all files in the directory
@ -449,10 +457,7 @@ func (f *Fs) put(ctx context.Context, in io.Reader, src fs.ObjectInfo, stream bo
srcPath := src.Remote() srcPath := src.Remote()
upstreams, err := f.create(ctx, srcPath) upstreams, err := f.create(ctx, srcPath)
if err == fs.ErrorObjectNotFound { if err == fs.ErrorObjectNotFound {
if err := f.Mkdir(ctx, parentDir(srcPath)); err != nil { upstreams, err = f.mkdir(ctx, parentDir(srcPath))
return nil, err
}
upstreams, err = f.create(ctx, srcPath)
} }
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -92,3 +92,24 @@ Configuration file is stored at:
Now transfer it to the remote box (scp, cut paste, ftp, sftp, etc.) and Now transfer it to the remote box (scp, cut paste, ftp, sftp, etc.) and
place it in the correct place (use `rclone config file` on the remote place it in the correct place (use `rclone config file` on the remote
box to find out where). box to find out where).
## Configuring using SSH Tunnel ##
Linux and MacOS users can utilize SSH Tunnel to redirect the headless box port 53682 to local machine by using the following command:
```
ssh -L localhost:53682:localhost:53682 username@remote_server
```
Then on the headless box run `rclone` config and answer `Y` to the `Use
auto config?` question.
```
...
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
y/n> y
```
Then copy and paste the auth url `http://127.0.0.1:53682/auth?state=xxxxxxxxxxxx` to the browser on your local machine, complete the auth and it is done.