Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a73ecec11f | ||
|
|
c223464cd0 | ||
|
|
39d09c04a2 | ||
|
|
db5494b316 | ||
|
|
c3dab09a94 | ||
|
|
3ddcbce989 | ||
|
|
0cf19ef66a | ||
|
|
655891170f | ||
|
|
93423a0812 | ||
|
|
78f33f5d6e | ||
|
|
209b7da3b2 | ||
|
|
6f71260acf | ||
|
|
ec6c3f2686 | ||
|
|
62e28d0a72 | ||
|
|
470642f2b7 | ||
|
|
b5002eb6a4 | ||
|
|
ee5698b3a9 | ||
|
|
728ff231ab | ||
|
|
542f938ce2 | ||
|
|
e24d0ac94d | ||
|
|
da2e2544ee | ||
|
|
72add5ab27 | ||
|
|
9ac72ee53f | ||
|
|
c3dac2e385 | ||
|
|
92294a4a92 | ||
|
|
69ff009264 | ||
|
|
27b157580e | ||
|
|
3f288bc9ea | ||
|
|
ce1b9a7daf | ||
|
|
f0512d1a52 | ||
|
|
51866fbd34 | ||
|
|
ee13bc6775 | ||
|
|
e86f62c3e8 | ||
|
|
6c3bf629a1 | ||
|
|
575e779b55 | ||
|
|
dc56ad9816 | ||
|
|
e7d04fc103 | ||
|
|
e2d7d413ef | ||
|
|
e7e9aa0dfa | ||
|
|
f88300a153 | ||
|
|
e54087ece1 | ||
|
|
54561fd2bc | ||
|
|
479c5a514a | ||
|
|
f3c7e1a9dd | ||
|
|
70b5b2f5c6 | ||
|
|
d7811f72ad | ||
|
|
aa20486485 | ||
|
|
33f302a06b | ||
|
|
24cb739d1f | ||
|
|
f0abd6173d | ||
|
|
1817d8f631 | ||
|
|
a308ad5bd7 | ||
|
|
b360527931 | ||
|
|
52b042971a | ||
|
|
2d2778eabf | ||
|
|
d55f8f0492 | ||
|
|
b44d0ea088 | ||
|
|
d981456ddc | ||
|
|
b22c4c4307 | ||
|
|
afc8cc550a | ||
|
|
83b642e98f | ||
|
|
d5d635b7f3 | ||
|
|
6b89e6c381 | ||
|
|
be0dd09801 | ||
|
|
b76cd4abd2 | ||
|
|
0dbf1230bc | ||
|
|
4fd9570332 | ||
|
|
8d77e48190 | ||
|
|
dcce65b2b3 | ||
|
|
4ce31555b2 | ||
|
|
5ed4bc97f3 | ||
|
|
54e37be591 | ||
|
|
eaa717b88a | ||
|
|
bbbc202ee6 | ||
|
|
97364fd0b6 | ||
|
|
c34f11a92f | ||
|
|
e31fc877e2 | ||
|
|
e069fc439e | ||
|
|
5250fcdf08 | ||
|
|
9876ba53f8 | ||
|
|
64662bef8d | ||
|
|
0b8d9084fc | ||
|
|
7be49249d3 | ||
|
|
8a6a8b9623 | ||
|
|
6fc88ff32e | ||
|
|
50928a5027 | ||
|
|
3a431056e2 | ||
|
|
53c3e5f0ab | ||
|
|
0edb025257 | ||
|
|
fded4dbea2 | ||
|
|
7e20e16cff | ||
|
|
1e88f0702a | ||
|
|
68333d34a1 | ||
|
|
740b3f6ae2 | ||
|
|
28fcc53e45 | ||
|
|
2ca477c57f | ||
|
|
9a11d3efd9 | ||
|
|
10d5377ed8 | ||
|
|
ee14efd3c2 | ||
|
|
b4be7d65a6 | ||
|
|
52e1bfae2a | ||
|
|
9c1e703777 | ||
|
|
b49821956a | ||
|
|
a61ba1e7c4 | ||
|
|
d30cc1e119 | ||
|
|
74a3dfc4e1 | ||
|
|
3fe9448229 | ||
|
|
a5cfdfd233 | ||
|
|
bdc19b7c8a | ||
|
|
e92cc8fe2b | ||
|
|
6ee4c62cae | ||
|
|
b047402294 | ||
|
|
7693cecd17 | ||
|
|
558f014d43 | ||
|
|
48508cb5b7 | ||
|
|
44c98e8654 | ||
|
|
9782c264e9 | ||
|
|
9cede6b372 | ||
|
|
decd960867 | ||
|
|
71028e0f06 | ||
|
|
52e96bc0e2 | ||
|
|
178ff62d6a | ||
|
|
9d335eb5cb | ||
|
|
20da3e6352 | ||
|
|
6381959850 | ||
|
|
8916455e4f | ||
|
|
8e214e838e | ||
|
|
23acd3ce01 | ||
|
|
a2e3af0523 | ||
|
|
5455d34f8c | ||
|
|
84512ac77d | ||
|
|
1ec0327ed7 | ||
|
|
0f07b63fd1 | ||
|
|
88ef475629 | ||
|
|
ade61fa756 | ||
|
|
cfc5f7bb2d | ||
|
|
ae9f8304fa | ||
|
|
55755a8e5b | ||
|
|
080050fac2 | ||
|
|
a243ea6353 | ||
|
|
51d2174c0b | ||
|
|
e75db0b14d | ||
|
|
c59a292719 | ||
|
|
be5b8b8dff | ||
|
|
525220b14e | ||
|
|
a9d29c2264 | ||
|
|
8f54dc06a2 | ||
|
|
7daf97f90a | ||
|
|
2cae017738 | ||
|
|
e172f00e0e | ||
|
|
412dacf8be | ||
|
|
cdacf026e4 | ||
|
|
0ca6408580 | ||
|
|
9627a6142d | ||
|
|
6cc783f20b | ||
|
|
3136a75f4d | ||
|
|
a9101f8608 | ||
|
|
af043eda15 | ||
|
|
35c210d36f | ||
|
|
3ed0440bd2 | ||
|
|
c13cff37ef | ||
|
|
fce734662f | ||
|
|
e0ba1a2cd2 | ||
|
|
c72fca2711 | ||
|
|
ae17d88518 | ||
|
|
e19fc49a5f | ||
|
|
95c0378e3c | ||
|
|
7ee3cfd7c9 | ||
|
|
bd2cdeeeab | ||
|
|
77cd93ef89 | ||
|
|
5b063679b5 | ||
|
|
09093a9954 | ||
|
|
df0cfa9735 | ||
|
|
64d7489fd2 | ||
|
|
ecedcd0e7f | ||
|
|
3dff91d691 | ||
|
|
e131ef3714 | ||
|
|
ea0bc278ba | ||
|
|
b553c23d5b | ||
|
|
4f954896a8 | ||
|
|
b259f8b752 | ||
|
|
8be8a8e41b | ||
|
|
79aa060e21 | ||
|
|
f9500729b7 | ||
|
|
204a19e67f | ||
|
|
e6ffe3464c | ||
|
|
0384364c3e | ||
|
|
763facfd78 | ||
|
|
bc88f1dafa | ||
|
|
0c055a1215 | ||
|
|
938d7951ab | ||
|
|
b4466bd9b1 | ||
|
|
31f76aa464 | ||
|
|
c887c164dc | ||
|
|
115ac00222 | ||
|
|
50e79bc087 | ||
|
|
abda616f84 | ||
|
|
9c3048580a | ||
|
|
c1d5faa32a | ||
|
|
d127d8686a | ||
|
|
bc9856b570 | ||
|
|
855071cc19 | ||
|
|
b179540e80 | ||
|
|
6a8e4690d3 | ||
|
|
917ea6ac57 | ||
|
|
7b47a1e842 | ||
|
|
bcd87009e2 | ||
|
|
caf85737c3 | ||
|
|
e1516e0159 | ||
|
|
ee1111e4c9 | ||
|
|
268fe0004c | ||
|
|
0c92a64bb3 | ||
|
|
8b61692754 | ||
|
|
663e6f3ec0 | ||
|
|
17633f5460 | ||
|
|
98c2d2c41b | ||
|
|
5135ff73cb | ||
|
|
58a82cd578 | ||
|
|
d86ea8623b | ||
|
|
cdeeff988e | ||
|
|
930ff266f2 | ||
|
|
d5c0fe632f | ||
|
|
3c5c5eeec2 | ||
|
|
56f017c60c | ||
|
|
b6517840ca | ||
|
|
1ccfea5aa9 | ||
|
|
7e858f4b8d | ||
|
|
7b4f368307 | ||
|
|
06a3502ed8 | ||
|
|
a9a43144ca | ||
|
|
dd968a8ccf | ||
|
|
0d6e1afe54 | ||
|
|
7d9faffd4b | ||
|
|
d7df065320 | ||
|
|
84d4d7f9d9 | ||
|
|
733d6fe56c | ||
|
|
8350544092 | ||
|
|
6a63bc2788 | ||
|
|
66e8c1600e | ||
|
|
82b8d68ffb | ||
|
|
b86bbcd67e | ||
|
|
38b6d607aa | ||
|
|
e1647a5a08 | ||
|
|
bc25190fc7 | ||
|
|
e3a41321cc | ||
|
|
2fd86c93fc | ||
|
|
2b8c461e04 | ||
|
|
a54692d165 | ||
|
|
4b4c59a4bb | ||
|
|
81d688107e | ||
|
|
6e003934fc | ||
|
|
37e1b20ec1 | ||
|
|
d1787b50fd | ||
|
|
9dfc346998 | ||
|
|
9ab4c19945 | ||
|
|
3bab119fa5 | ||
|
|
1fdf3e2aae | ||
|
|
4810aa65a4 | ||
|
|
f798552cf1 | ||
|
|
4dc030d081 | ||
|
|
216499d78b | ||
|
|
60f636ee15 | ||
|
|
f0bf117a04 | ||
|
|
788b6ce821 | ||
|
|
503cd84919 |
No files matched your search
@@ -0,0 +1,46 @@
|
||||
version: "{build}"
|
||||
|
||||
os: Windows Server 2012 R2
|
||||
|
||||
clone_folder: c:\gopath\src\github.com\ncw\rclone
|
||||
|
||||
environment:
|
||||
GOPATH: C:\gopath
|
||||
CPATH: C:\Program Files (x86)\WinFsp\inc\fuse
|
||||
ORIGPATH: '%PATH%'
|
||||
NOCCPATH: C:\MinGW\bin;%GOPATH%\bin;%PATH%
|
||||
PATHCC64: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;%NOCCPATH%
|
||||
PATHCC32: C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin;%NOCCPATH%
|
||||
PATH: '%PATHCC64%'
|
||||
RCLONE_CONFIG_PASS:
|
||||
secure: HbzxSy9zQ8NYWN9NNPf6ALQO9Q0mwRNqwehsLcOEHy0=
|
||||
|
||||
install:
|
||||
- choco install winfsp -y
|
||||
- choco install zip -y
|
||||
- copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe
|
||||
|
||||
build_script:
|
||||
- echo %PATH%
|
||||
- echo %GOPATH%
|
||||
- go version
|
||||
- go env
|
||||
- go install
|
||||
- go build
|
||||
- make log_since_last_release > %TEMP%\git-log.txt
|
||||
- make version > %TEMP%\version
|
||||
- set /p RCLONE_VERSION=<%TEMP%\version
|
||||
- set PATH=%PATHCC32%
|
||||
- go run bin/cross-compile.go -release beta-latest -git-log %TEMP%\git-log.txt -include "^windows/386" -cgo -tags cmount %RCLONE_VERSION%
|
||||
- set PATH=%PATHCC64%
|
||||
- go run bin/cross-compile.go -release beta-latest -git-log %TEMP%\git-log.txt -include "^windows/amd64" -cgo -no-clean -tags cmount %RCLONE_VERSION%
|
||||
|
||||
test_script:
|
||||
- make GOTAGS=cmount quicktest
|
||||
|
||||
artifacts:
|
||||
- path: rclone.exe
|
||||
- path: build/*-v*.zip
|
||||
|
||||
deploy_script:
|
||||
- IF "%APPVEYOR_REPO_BRANCH%" == "master" make upload_beta
|
||||
@@ -0,0 +1,31 @@
|
||||
version: 2
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
machine: true
|
||||
|
||||
working_directory: ~/.go_workspace/src/github.com/ncw/rclone
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
|
||||
- run:
|
||||
name: Cross-compile rclone
|
||||
command: |
|
||||
docker pull billziss/xgo-cgofuse
|
||||
go get -v github.com/karalabe/xgo
|
||||
xgo \
|
||||
--image=billziss/xgo-cgofuse \
|
||||
--targets=darwin/386,darwin/amd64,linux/386,linux/amd64,windows/386,windows/amd64 \
|
||||
-tags cmount \
|
||||
.
|
||||
|
||||
- run:
|
||||
name: Prepare artifacts
|
||||
command: |
|
||||
mkdir -p /tmp/rclone.dist
|
||||
cp -R rclone-* /tmp/rclone.dist
|
||||
|
||||
- store_artifacts:
|
||||
path: /tmp/rclone.dist
|
||||
+11
-4
@@ -4,10 +4,9 @@ osx_image: xcode7.3
|
||||
os:
|
||||
- linux
|
||||
go:
|
||||
- 1.5.4
|
||||
- 1.6.4
|
||||
- 1.7.4
|
||||
- 1.8
|
||||
- 1.8.3
|
||||
- tip
|
||||
install:
|
||||
- git fetch --unshallow --tags
|
||||
@@ -17,18 +16,26 @@ script:
|
||||
- make check
|
||||
- make quicktest
|
||||
env:
|
||||
global:
|
||||
- GOTAGS=cmount
|
||||
matrix:
|
||||
secure: gU8gCV9R8Kv/Gn0SmCP37edpfIbPoSvsub48GK7qxJdTU628H0KOMiZW/T0gtV5d67XJZ4eKnhJYlxwwxgSgfejO32Rh5GlYEKT/FuVoH0BD72dM1GDFLSrUiUYOdoHvf/BKIFA3dJFT4lk2ASy4Zh7SEoXHG6goBlqUpYx8hVA=
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- fuse
|
||||
- libfuse-dev
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: tip
|
||||
include:
|
||||
- os: osx
|
||||
go: 1.8
|
||||
go: 1.8.3
|
||||
env: GOTAGS=""
|
||||
deploy:
|
||||
provider: script
|
||||
script: make travis_beta
|
||||
on:
|
||||
branch: master
|
||||
go: 1.8
|
||||
go: 1.8.3
|
||||
condition: "`uname` == 'Linux'"
|
||||
+43
-11
@@ -10,7 +10,7 @@ of filing an issue.
|
||||
|
||||
When filing an issue, please include the following information if
|
||||
possible as well as a description of the problem. Make sure you test
|
||||
with the [latest beta of rclone](http://beta.rclone.org/):
|
||||
with the [latest beta of rclone](https://beta.rclone.org/):
|
||||
|
||||
* Rclone version (eg output from `rclone -V`)
|
||||
* Which OS you are using and how many bits (eg Windows 7, 64 bit)
|
||||
@@ -139,14 +139,42 @@ Documentation for rclone sub commands is with their code, eg
|
||||
There are separate instructions for making a release in the RELEASE.md
|
||||
file.
|
||||
|
||||
## Updating the vendor dirctory ##
|
||||
## Adding a dependency ##
|
||||
|
||||
Do these commands to update the entire build directory to the latest
|
||||
version of all the dependencies. This should be done early in the
|
||||
release cycle. Individual dependencies can be added with `godep get`.
|
||||
rclone uses the [dep](https://github.com/golang/dep) tool to manage
|
||||
its dependencies. All code that rclone needs for building is stored
|
||||
in the `vendor` directory for perfectly reproducable builds.
|
||||
|
||||
* make build_dep
|
||||
* make update
|
||||
The `vendor` directory is entirely managed by the `dep` tool.
|
||||
|
||||
To add a new dependency
|
||||
|
||||
dep ensure github.com/pkg/errors
|
||||
|
||||
You can add constraints on that package (see the `dep` documentation),
|
||||
but don't unless you really need to.
|
||||
|
||||
Please check in the changes generated by dep including the `vendor`
|
||||
directory and `Godep.toml` and `Godep.locl` in a single commit
|
||||
separate from any other code changes. Watch out for new files in
|
||||
`vendor`.
|
||||
|
||||
## Updating a dependency ##
|
||||
|
||||
If you need to update a dependency then run
|
||||
|
||||
dep ensure -update github.com/pkg/errors
|
||||
|
||||
Check in in a single commit as above.
|
||||
|
||||
## Updating all the dependencies ##
|
||||
|
||||
In order to update all the dependencies then run `make update`. This
|
||||
just runs `dep ensure -update`. Check in the changes in a single
|
||||
commit as above.
|
||||
|
||||
This should be done early in the release cycle to pick up new versions
|
||||
of packages in time for them to get some testing.
|
||||
|
||||
## Writing a new backend ##
|
||||
|
||||
@@ -162,8 +190,8 @@ Research
|
||||
|
||||
Getting going
|
||||
|
||||
* Create `remote/remote.go` (copy this from a similar fs)
|
||||
* Add your fs to the imports in `fs/all/all.go`
|
||||
* Create `remote/remote.go` (copy this from a similar remote)
|
||||
* Add your remote to the imports in `fs/all/all.go`
|
||||
|
||||
Unit tests
|
||||
|
||||
@@ -177,10 +205,13 @@ Integration tests
|
||||
* Add your fs to `fs/test_all.go`
|
||||
* Make sure integration tests pass with
|
||||
* `cd fs`
|
||||
* `go test -v -remote TestRemote:` and
|
||||
* `go test -v -remote TestRemote:`
|
||||
* If you are making a bucket based remote, then check with this also
|
||||
* `go test -v -remote TestRemote: -subdir`
|
||||
* And if your remote defines `ListR` this also
|
||||
* `go test -v -remote TestRemote: -fast-list`
|
||||
|
||||
Add your fs to the docs
|
||||
Add your fs to the docs - you'll need to pick an icon for it from [fontawesome](http://fontawesome.io/icons/).
|
||||
|
||||
* `README.md` - main Github page
|
||||
* `docs/content/remote.md` - main docs page
|
||||
@@ -189,3 +220,4 @@ Add your fs to the docs
|
||||
* `docs/content/about.md` - front page of rclone.org
|
||||
* `docs/layouts/chrome/navbar.html` - add it to the website navigation
|
||||
* `bin/make_manual.py` - add the page to the `docs` constant
|
||||
* `cmd/cmd.go` - the main help for rclone
|
||||
Generated
-513
@@ -1,513 +0,0 @@
|
||||
{
|
||||
"ImportPath": "github.com/ncw/rclone",
|
||||
"GoVersion": "go1.7",
|
||||
"GodepVersion": "v75",
|
||||
"Packages": [
|
||||
"./..."
|
||||
],
|
||||
"Deps": [
|
||||
{
|
||||
"ImportPath": "bazil.org/fuse",
|
||||
"Rev": "371fbbdaa8987b715bdd21d6adc4c9b20155f748"
|
||||
},
|
||||
{
|
||||
"ImportPath": "bazil.org/fuse/fs",
|
||||
"Rev": "371fbbdaa8987b715bdd21d6adc4c9b20155f748"
|
||||
},
|
||||
{
|
||||
"ImportPath": "bazil.org/fuse/fuseutil",
|
||||
"Rev": "371fbbdaa8987b715bdd21d6adc4c9b20155f748"
|
||||
},
|
||||
{
|
||||
"ImportPath": "cloud.google.com/go/compute/metadata",
|
||||
"Comment": "v0.6.0-68-g0b87d14",
|
||||
"Rev": "0b87d14d90086b53a97dfbd66f3000f7f112b494"
|
||||
},
|
||||
{
|
||||
"ImportPath": "cloud.google.com/go/internal",
|
||||
"Comment": "v0.6.0-68-g0b87d14",
|
||||
"Rev": "0b87d14d90086b53a97dfbd66f3000f7f112b494"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Unknwon/goconfig",
|
||||
"Rev": "87a46d97951ee1ea20ed3b24c25646a79e87ba5d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/VividCortex/ewma",
|
||||
"Comment": "v1.0-20-gc595cd8",
|
||||
"Rev": "c595cd886c223c6c28fc9ae2727a61b5e4693d85"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/awserr",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/awsutil",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/client",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/client/metadata",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/corehandlers",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/credentials",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/credentials/endpointcreds",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/credentials/stscreds",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/defaults",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/ec2metadata",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/endpoints",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/request",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/session",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws/signer/v4",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/private/protocol",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/private/protocol/query",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/private/protocol/query/queryutil",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/private/protocol/rest",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/private/protocol/restxml",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/private/waiter",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/service/s3",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/service/s3/s3iface",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/service/s3/s3manager",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/service/sts",
|
||||
"Comment": "v1.6.24-1-g2d3b3bc",
|
||||
"Rev": "2d3b3bc3aae6a09a9b194aa6eb71326fcbe2e918"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/cpuguy83/go-md2man/md2man",
|
||||
"Comment": "v1.0.6",
|
||||
"Rev": "a65d4d2de4d5f7c74868dfa9b202a3c8be315aaa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/davecgh/go-spew/spew",
|
||||
"Comment": "v1.1.0",
|
||||
"Rev": "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/go-ini/ini",
|
||||
"Comment": "v1.24.0-2-gee900ca",
|
||||
"Rev": "ee900ca565931451fe4e4409bcbd4316331cec1c"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/golang/protobuf/proto",
|
||||
"Rev": "8ee79997227bf9b34611aee7946ae64735e6fd93"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/go-querystring/query",
|
||||
"Rev": "53e6ce116135b80d037921a7fdd5138cf32d7a8a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/googleapis/gax-go",
|
||||
"Rev": "da06d194a00e19ce00d9011a13931c3f6f6887c7"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/inconshreveable/mousetrap",
|
||||
"Rev": "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/jmespath/go-jmespath",
|
||||
"Comment": "0.2.2-14-gbd40a43",
|
||||
"Rev": "bd40a432e4c76585ef6b72d3fd96fb9b6dc7b68d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/kr/fs",
|
||||
"Rev": "2788f0dbd16903de03cb8186e5c7d97b69ad387b"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/ncw/go-acd",
|
||||
"Rev": "7954f1fad2bda6a7836999003e4481d6e32edc1e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/ncw/swift",
|
||||
"Rev": "6c1b1510538e1f00d49a558b7b9b87d71bc454d6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pkg/errors",
|
||||
"Comment": "v0.8.0-2-g248dadf",
|
||||
"Rev": "248dadf4e9068a0b3e79f02ed0a610d935de5302"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pkg/sftp",
|
||||
"Rev": "ff7e52ffd762466ebd2c4e710d5436dccc539f54"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pmezard/go-difflib/difflib",
|
||||
"Comment": "v1.0.0",
|
||||
"Rev": "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/rfjakob/eme",
|
||||
"Comment": "v1.0-15-gfd00240",
|
||||
"Rev": "fd00240838d2e0fe6b2c58bf5b27db843d828ad5"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/russross/blackfriday",
|
||||
"Comment": "v1.4-40-g5f33e7b",
|
||||
"Rev": "5f33e7b7878355cd2b7e6b8eefc48a5472c69f70"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/shurcooL/sanitized_anchor_name",
|
||||
"Rev": "1dba4b3954bc059efc3991ec364f9f9a35f597d2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/skratchdot/open-golang/open",
|
||||
"Rev": "75fb7ed4208cf72d323d7d02fd1a5964a7a9073c"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/spf13/cobra",
|
||||
"Rev": "b5d8e8f46a2f829f755b6e33b454e25c61c935e1"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/spf13/cobra/doc",
|
||||
"Rev": "b5d8e8f46a2f829f755b6e33b454e25c61c935e1"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/spf13/pflag",
|
||||
"Rev": "9ff6c6923cfffbcd502984b8e0c80539a94968b7"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/stacktic/dropbox",
|
||||
"Rev": "58f839b21094d5e0af7caf613599830589233d20"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/stretchr/testify/assert",
|
||||
"Comment": "v1.1.4-27-g4d4bfba",
|
||||
"Rev": "4d4bfba8f1d1027c4fdbe371823030df51419987"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/stretchr/testify/require",
|
||||
"Comment": "v1.1.4-27-g4d4bfba",
|
||||
"Rev": "4d4bfba8f1d1027c4fdbe371823030df51419987"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/tsenart/tb",
|
||||
"Rev": "19f4c3d79d2bd67d0911b2e310b999eeea4454c1"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/curve25519",
|
||||
"Rev": "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/ed25519",
|
||||
"Rev": "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/ed25519/internal/edwards25519",
|
||||
"Rev": "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/nacl/secretbox",
|
||||
"Rev": "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/pbkdf2",
|
||||
"Rev": "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/poly1305",
|
||||
"Rev": "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/salsa20/salsa",
|
||||
"Rev": "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/scrypt",
|
||||
"Rev": "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/ssh",
|
||||
"Rev": "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/ssh/agent",
|
||||
"Rev": "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/crypto/ssh/terminal",
|
||||
"Rev": "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/context",
|
||||
"Rev": "b4690f45fa1cafc47b1c280c2e75116efe40cc13"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/context/ctxhttp",
|
||||
"Rev": "b4690f45fa1cafc47b1c280c2e75116efe40cc13"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/http2",
|
||||
"Rev": "b4690f45fa1cafc47b1c280c2e75116efe40cc13"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/http2/hpack",
|
||||
"Rev": "b4690f45fa1cafc47b1c280c2e75116efe40cc13"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/idna",
|
||||
"Rev": "b4690f45fa1cafc47b1c280c2e75116efe40cc13"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/internal/timeseries",
|
||||
"Rev": "b4690f45fa1cafc47b1c280c2e75116efe40cc13"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/lex/httplex",
|
||||
"Rev": "b4690f45fa1cafc47b1c280c2e75116efe40cc13"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/net/trace",
|
||||
"Rev": "b4690f45fa1cafc47b1c280c2e75116efe40cc13"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/oauth2",
|
||||
"Rev": "b9780ec78894ab900c062d58ee3076cd9b2a4501"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/oauth2/google",
|
||||
"Rev": "b9780ec78894ab900c062d58ee3076cd9b2a4501"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/oauth2/internal",
|
||||
"Rev": "b9780ec78894ab900c062d58ee3076cd9b2a4501"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/oauth2/jws",
|
||||
"Rev": "b9780ec78894ab900c062d58ee3076cd9b2a4501"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/oauth2/jwt",
|
||||
"Rev": "b9780ec78894ab900c062d58ee3076cd9b2a4501"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/sys/unix",
|
||||
"Rev": "075e574b89e4c2d22f2286a7e2b919519c6f3547"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/transform",
|
||||
"Rev": "85c29909967d7f171f821e7a42e7b7af76fb9598"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/unicode/norm",
|
||||
"Rev": "85c29909967d7f171f821e7a42e7b7af76fb9598"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/api/drive/v2",
|
||||
"Rev": "bc20c61134e1d25265dd60049f5735381e79b631"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/api/gensupport",
|
||||
"Rev": "bc20c61134e1d25265dd60049f5735381e79b631"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/api/googleapi",
|
||||
"Rev": "bc20c61134e1d25265dd60049f5735381e79b631"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/api/googleapi/internal/uritemplates",
|
||||
"Rev": "bc20c61134e1d25265dd60049f5735381e79b631"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/api/storage/v1",
|
||||
"Rev": "bc20c61134e1d25265dd60049f5735381e79b631"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/appengine",
|
||||
"Comment": "v1.0.0-28-g2e4a801",
|
||||
"Rev": "2e4a801b39fc199db615bfca7d0b9f8cd9580599"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/appengine/internal",
|
||||
"Comment": "v1.0.0-28-g2e4a801",
|
||||
"Rev": "2e4a801b39fc199db615bfca7d0b9f8cd9580599"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/appengine/internal/app_identity",
|
||||
"Comment": "v1.0.0-28-g2e4a801",
|
||||
"Rev": "2e4a801b39fc199db615bfca7d0b9f8cd9580599"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/appengine/internal/base",
|
||||
"Comment": "v1.0.0-28-g2e4a801",
|
||||
"Rev": "2e4a801b39fc199db615bfca7d0b9f8cd9580599"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/appengine/internal/datastore",
|
||||
"Comment": "v1.0.0-28-g2e4a801",
|
||||
"Rev": "2e4a801b39fc199db615bfca7d0b9f8cd9580599"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/appengine/internal/log",
|
||||
"Comment": "v1.0.0-28-g2e4a801",
|
||||
"Rev": "2e4a801b39fc199db615bfca7d0b9f8cd9580599"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/appengine/internal/modules",
|
||||
"Comment": "v1.0.0-28-g2e4a801",
|
||||
"Rev": "2e4a801b39fc199db615bfca7d0b9f8cd9580599"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/appengine/internal/remote_api",
|
||||
"Comment": "v1.0.0-28-g2e4a801",
|
||||
"Rev": "2e4a801b39fc199db615bfca7d0b9f8cd9580599"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc",
|
||||
"Comment": "v1.0.5-52-gd0c32ee",
|
||||
"Rev": "d0c32ee6a441117d49856d6120ca9552af413ee0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/codes",
|
||||
"Comment": "v1.0.5-52-gd0c32ee",
|
||||
"Rev": "d0c32ee6a441117d49856d6120ca9552af413ee0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/credentials",
|
||||
"Comment": "v1.0.5-52-gd0c32ee",
|
||||
"Rev": "d0c32ee6a441117d49856d6120ca9552af413ee0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/grpclog",
|
||||
"Comment": "v1.0.5-52-gd0c32ee",
|
||||
"Rev": "d0c32ee6a441117d49856d6120ca9552af413ee0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/internal",
|
||||
"Comment": "v1.0.5-52-gd0c32ee",
|
||||
"Rev": "d0c32ee6a441117d49856d6120ca9552af413ee0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/metadata",
|
||||
"Comment": "v1.0.5-52-gd0c32ee",
|
||||
"Rev": "d0c32ee6a441117d49856d6120ca9552af413ee0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/naming",
|
||||
"Comment": "v1.0.5-52-gd0c32ee",
|
||||
"Rev": "d0c32ee6a441117d49856d6120ca9552af413ee0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/peer",
|
||||
"Comment": "v1.0.5-52-gd0c32ee",
|
||||
"Rev": "d0c32ee6a441117d49856d6120ca9552af413ee0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/stats",
|
||||
"Comment": "v1.0.5-52-gd0c32ee",
|
||||
"Rev": "d0c32ee6a441117d49856d6120ca9552af413ee0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/tap",
|
||||
"Comment": "v1.0.5-52-gd0c32ee",
|
||||
"Rev": "d0c32ee6a441117d49856d6120ca9552af413ee0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "google.golang.org/grpc/transport",
|
||||
"Comment": "v1.0.5-52-gd0c32ee",
|
||||
"Rev": "d0c32ee6a441117d49856d6120ca9552af413ee0"
|
||||
},
|
||||
{
|
||||
"ImportPath": "gopkg.in/yaml.v2",
|
||||
"Rev": "a3f3340b5840cee44f372bddb5880fcbc419b46a"
|
||||
}
|
||||
]
|
||||
}
|
||||
Generated
+267
@@ -0,0 +1,267 @@
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "bazil.org/fuse"
|
||||
packages = [".","fs","fuseutil"]
|
||||
revision = "371fbbdaa8987b715bdd21d6adc4c9b20155f748"
|
||||
|
||||
[[projects]]
|
||||
name = "cloud.google.com/go"
|
||||
packages = ["compute/metadata","internal"]
|
||||
revision = "2e6a95edb1071d750f6d7db777bf66cd2997af6c"
|
||||
version = "v0.7.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/Unknwon/goconfig"
|
||||
packages = ["."]
|
||||
revision = "87a46d97951ee1ea20ed3b24c25646a79e87ba5d"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/VividCortex/ewma"
|
||||
packages = ["."]
|
||||
revision = "c595cd886c223c6c28fc9ae2727a61b5e4693d85"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/aws/aws-sdk-go"
|
||||
packages = ["aws","aws/awserr","aws/awsutil","aws/client","aws/client/metadata","aws/corehandlers","aws/credentials","aws/credentials/ec2rolecreds","aws/credentials/endpointcreds","aws/credentials/stscreds","aws/defaults","aws/ec2metadata","aws/endpoints","aws/request","aws/session","aws/signer/v4","private/protocol","private/protocol/query","private/protocol/query/queryutil","private/protocol/rest","private/protocol/restxml","private/protocol/xml/xmlutil","service/s3","service/s3/s3iface","service/s3/s3manager","service/sts"]
|
||||
revision = "57572ec625c9aa8bf5c45453efa923bacabc0afe"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/billziss-gh/cgofuse"
|
||||
packages = ["fuse"]
|
||||
revision = "35bcf037030dcadcd247618c75c00c6cd17482d7"
|
||||
version = "v1.0.2"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/cpuguy83/go-md2man"
|
||||
packages = ["md2man"]
|
||||
revision = "a65d4d2de4d5f7c74868dfa9b202a3c8be315aaa"
|
||||
version = "v1.0.6"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/go-ini/ini"
|
||||
packages = ["."]
|
||||
revision = "e7fea39b01aea8d5671f6858f0532f56e8bff3a5"
|
||||
version = "v1.27.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = ["proto","ptypes/any"]
|
||||
revision = "b50ceb1fa9818fa4d78b016c2d4ae025593a7ce3"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/google/go-querystring"
|
||||
packages = ["query"]
|
||||
revision = "53e6ce116135b80d037921a7fdd5138cf32d7a8a"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/googleapis/gax-go"
|
||||
packages = ["."]
|
||||
revision = "9af46dd5a1713e8b5cd71106287eba3cefdde50b"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/inconshreveable/mousetrap"
|
||||
packages = ["."]
|
||||
revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/jlaffaye/ftp"
|
||||
packages = ["."]
|
||||
revision = "5c7b901224c7880b293e0b5486cb6ebf97bfca37"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/jmespath/go-jmespath"
|
||||
packages = ["."]
|
||||
revision = "3433f3ea46d9f8019119e7dd41274e112a2359a9"
|
||||
version = "0.2.2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/kr/fs"
|
||||
packages = ["."]
|
||||
revision = "2788f0dbd16903de03cb8186e5c7d97b69ad387b"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-runewidth"
|
||||
packages = ["."]
|
||||
revision = "9e777a8366cce605130a531d2cd6363d07ad7317"
|
||||
version = "v0.0.2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/ncw/dropbox-sdk-go-unofficial"
|
||||
packages = ["dropbox","dropbox/async","dropbox/files","dropbox/properties"]
|
||||
revision = "5d9f46f9862ae5f65e264e178de6ce2c41a32d40"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/ncw/go-acd"
|
||||
packages = ["."]
|
||||
revision = "96a49aad3fc3889629f2eceb004927386884bd92"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/ncw/swift"
|
||||
packages = ["."]
|
||||
revision = "8e9b10220613abdbc2896808ee6b43e411a4fa6c"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/nsf/termbox-go"
|
||||
packages = ["."]
|
||||
revision = "4163cd39dda1c0dda883a713640bc01e08951c24"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/pkg/errors"
|
||||
packages = ["."]
|
||||
revision = "c605e284fe17294bda444b34710735b29d1a9d90"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/pkg/sftp"
|
||||
packages = ["."]
|
||||
revision = "a5f8514e29e90a859e93871b1582e5c81f466f82"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
packages = ["difflib"]
|
||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/rfjakob/eme"
|
||||
packages = ["."]
|
||||
revision = "da627cc50b6fb2eb623eaffe91fb29d7eddfd06a"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/russross/blackfriday"
|
||||
packages = ["."]
|
||||
revision = "0b647d0506a698cca42caca173e55559b12a69f2"
|
||||
version = "v1.4"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/shurcooL/sanitized_anchor_name"
|
||||
packages = ["."]
|
||||
revision = "79c90efaf01eddc01945af5bc1797859189b830b"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/skratchdot/open-golang"
|
||||
packages = ["open"]
|
||||
revision = "75fb7ed4208cf72d323d7d02fd1a5964a7a9073c"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/cobra"
|
||||
packages = [".","doc"]
|
||||
revision = "90687e7bfc7e1e5cd88eb1f513f32f01dc03dd7c"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/pflag"
|
||||
packages = ["."]
|
||||
revision = "e57e3eeb33f795204c1ca35f56c44f83227c6e66"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = ["assert","require"]
|
||||
revision = "4d4bfba8f1d1027c4fdbe371823030df51419987"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/xanzy/ssh-agent"
|
||||
packages = ["."]
|
||||
revision = "ba9c9e33906f58169366275e3450db66139a31a9"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = ["curve25519","ed25519","ed25519/internal/edwards25519","nacl/secretbox","pbkdf2","poly1305","salsa20/salsa","scrypt","ssh","ssh/agent","ssh/terminal"]
|
||||
revision = "122d919ec1efcfb58483215da23f815853e24b81"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/net"
|
||||
packages = ["context","context/ctxhttp","html","html/atom","http2","http2/hpack","idna","internal/timeseries","lex/httplex","trace"]
|
||||
revision = "c9b681d35165f1995d6f3034e61f8761d4b90c99"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/oauth2"
|
||||
packages = [".","google","internal","jws","jwt"]
|
||||
revision = "ad516a297a9f2a74ecc244861b298c94bdd28b9d"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "9ccfe848b9db8435a24c424abbc07a921adf1df5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/text"
|
||||
packages = ["internal/gen","internal/triegen","internal/ucd","secure/bidirule","transform","unicode/bidi","unicode/cldr","unicode/norm","unicode/rangetable"]
|
||||
revision = "470f45bf29f4147d6fbd7dfd0a02a848e49f5bf4"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/time"
|
||||
packages = ["rate"]
|
||||
revision = "8be79e1e0910c292df4e79c241bb7e8f7e725959"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "google.golang.org/api"
|
||||
packages = ["drive/v2","gensupport","googleapi","googleapi/internal/uritemplates","storage/v1"]
|
||||
revision = "c858ef4400610cbfd097ffc5f5c6e4a1a51eac86"
|
||||
|
||||
[[projects]]
|
||||
name = "google.golang.org/appengine"
|
||||
packages = [".","internal","internal/app_identity","internal/base","internal/datastore","internal/log","internal/modules","internal/remote_api","internal/urlfetch","urlfetch"]
|
||||
revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = ["googleapis/rpc/status"]
|
||||
revision = "411e09b969b1170a9f0c467558eb4c4c110d9c77"
|
||||
|
||||
[[projects]]
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [".","codes","credentials","grpclb/grpc_lb_v1","grpclog","internal","keepalive","metadata","naming","peer","stats","status","tap","transport"]
|
||||
revision = "d2e1b51f33ff8c5e4a15560ff049d200e83726c5"
|
||||
version = "v1.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "v2"
|
||||
name = "gopkg.in/yaml.v2"
|
||||
packages = ["."]
|
||||
revision = "cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "d1197786e4b7133a2e775df76d12dc57d690f2136871f8b0ad3f793c48b4ab08"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
|
||||
## Gopkg.toml example (these lines may be deleted)
|
||||
|
||||
## "required" lists a set of packages (not projects) that must be included in
|
||||
## Gopkg.lock. This list is merged with the set of packages imported by the current
|
||||
## project. Use it when your project needs a package it doesn't explicitly import -
|
||||
## including "main" packages.
|
||||
# required = ["github.com/user/thing/cmd/thing"]
|
||||
|
||||
## "ignored" lists a set of packages (not projects) that are ignored when
|
||||
## dep statically analyzes source code. Ignored packages can be in this project,
|
||||
## or in a dependency.
|
||||
# ignored = ["github.com/user/project/badpkg"]
|
||||
|
||||
## Dependencies define constraints on dependent projects. They are respected by
|
||||
## dep whether coming from the Gopkg.toml of the current project or a dependency.
|
||||
# [[constraint]]
|
||||
## Required: the root import path of the project being constrained.
|
||||
# name = "github.com/user/project"
|
||||
#
|
||||
## Recommended: the version constraint to enforce for the project.
|
||||
## Only one of "branch", "version" or "revision" can be specified.
|
||||
# version = "1.0.0"
|
||||
# branch = "master"
|
||||
# revision = "abc123"
|
||||
#
|
||||
## Optional: an alternate location (URL or import path) for the project's source.
|
||||
# source = "https://github.com/myfork/package.git"
|
||||
|
||||
## Overrides have the same structure as [[constraint]], but supercede all
|
||||
## [[constraint]] declarations from all projects. Only the current project's
|
||||
## [[override]] are applied.
|
||||
##
|
||||
## Overrides are a sledgehammer. Use them only as a last resort.
|
||||
# [[override]]
|
||||
## Required: the root import path of the project being constrained.
|
||||
# name = "github.com/user/project"
|
||||
#
|
||||
## Optional: specifying a version constraint override will cause all other
|
||||
## constraints on this project to be ignored; only the overriden constraint
|
||||
## need be satisfied.
|
||||
## Again, only one of "branch", "version" or "revision" can be specified.
|
||||
# version = "1.0.0"
|
||||
# branch = "master"
|
||||
# revision = "abc123"
|
||||
#
|
||||
## Optional: specifying an alternate source location as an override will
|
||||
## enforce that the alternate location is used for that project, regardless of
|
||||
## what source location any dependent projects specify.
|
||||
# source = "https://github.com/myfork/package.git"
|
||||
|
||||
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "bazil.org/fuse"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/Unknwon/goconfig"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/VividCortex/ewma"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/aws/aws-sdk-go"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/ncw/go-acd"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/ncw/swift"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/pkg/errors"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/pkg/sftp"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/rfjakob/eme"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/skratchdot/open-golang"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/cobra"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/pflag"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/stacktic/dropbox"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/stretchr/testify"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/tsenart/tb"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/crypto"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/net"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/oauth2"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/text"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "google.golang.org/api"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/ncw/dropbox-sdk-go-unofficial"
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
When filing an issue, please include the following information if possible as well as a description of the problem. Make sure you test with the latest beta of rclone.
|
||||
|
||||
http://beta.rclone.org/
|
||||
http://rclone.org/downloads/
|
||||
https://beta.rclone.org/
|
||||
https://rclone.org/downloads/
|
||||
|
||||
If you've just got a question or aren't sure if you've found a bug then please use the [rclone forum](https://forum.rclone.org/) instead of filing an issue.
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
# Maintainers guide for rclone #
|
||||
|
||||
Current active maintainers of rclone are
|
||||
|
||||
* Nick Craig-Wood
|
||||
* Stefan Breunig
|
||||
|
||||
**This is a work in progress Draft**
|
||||
|
||||
This is a guide for how to be an rclone maintainer.
|
||||
|
||||
## Triaging Tickets ##
|
||||
|
||||
***FIXME*** this section needs some work!
|
||||
|
||||
When a ticket comes in it should be triaged. This means it should be classified into a bug or an enhancement or a request for support.
|
||||
|
||||
Quite a lot of tickets need a bit of back an forth to determine whether it is a valid ticket.
|
||||
|
||||
If it turns out to be a bug or an enhancement it should be tagged as such, with the appropriate other tags. Don't forget the "quickie" tag to give new contributors something easy to do to get going.
|
||||
|
||||
When a ticket is tagged it should be added to a milestone, either the next release, the one after, Soon or Unplanned. Bugs can be added to the "Known Bugs" milestone if they aren't planned to be fixed or need to wait for something (eg the next go release).
|
||||
|
||||
***FIXME*** I don't think I've quite got the milestone thing sorted yet. I was wondering about classifying them into priority, or what?
|
||||
|
||||
Tickets [with no milestone](https://github.com/ncw/rclone/issues?utf8=✓&q=is%3Aissue%20is%3Aopen%20no%3Amile) are good candidates for ones that have slipped between the gaps and need following up.
|
||||
|
||||
## Closing Tickets ##
|
||||
|
||||
Close tickets as soon as you can - make sure they are tagged with a release. Post a link to a beta in the ticket with the fix in, asking for feedback.
|
||||
|
||||
## Pull requests ##
|
||||
|
||||
Try to process pull requests promptly!
|
||||
|
||||
Merging pull requests on Github itself works quite well now-a-days so you can squash and rebase or rebase pull requests. rclone doesn't use merge commits.
|
||||
|
||||
Sometimes pull requests need to be left open for a while - this especially true of contributions of new backends which take a long time to get right.
|
||||
|
||||
## Merges ##
|
||||
|
||||
If you are merging a branch locally then do `git merge --ff-only branch-name` to avoid a merge commit. You'll need to rebase the branch if it doesn't merge cleanly.
|
||||
|
||||
## Release cycle ##
|
||||
|
||||
Rclone aims for a 6-8 week release cycle. Sometimes release cycles take longer if there is something big to merge that didn't stabilize properly or for personal reasons.
|
||||
|
||||
High impact regressions should be fixed before the next release.
|
||||
|
||||
Near the start of the release cycle the dependencies should be updated with `make update` to give time for bugs to surface.
|
||||
|
||||
Towards the end of the release cycle try not to merge anything too big so let things settle down.
|
||||
|
||||
Follow the instructions in RELEASE.md for making the release. Note that the testing part is the most time consuming often needing several rounds of test and fix depending on exactly how many new features rclone has gained.
|
||||
|
||||
## TODO ##
|
||||
|
||||
I should probably make a mailing list for maintainers or at least an rclone-dev list, and I should probably make a dev@rclone.org to register with cloud providers.
|
||||
+1037
-626
File diff suppressed because it is too large.
Load diff
+1178
-240
File diff suppressed because it is too large.
Load diff
@@ -1,19 +1,21 @@
|
||||
SHELL = /bin/bash
|
||||
TAG := $(shell echo `git describe --tags`-`git rev-parse --abbrev-ref HEAD` | sed 's/-\([0-9]\)-/-0\1-/; s/-\(HEAD\|master\)$$//')
|
||||
TAG := $(shell echo `git describe --abbrev=8 --tags`-`git rev-parse --abbrev-ref HEAD` | sed 's/-\([0-9]\)-/-00\1-/; s/-\([0-9][0-9]\)-/-0\1-/; s/-\(HEAD\|master\)$$//')
|
||||
LAST_TAG := $(shell git describe --tags --abbrev=0)
|
||||
NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f", $$_)')
|
||||
GO_VERSION := $(shell go version)
|
||||
GO_FILES := $(shell go list ./... | grep -v /vendor/ )
|
||||
GO_LATEST := $(findstring go1.8,$(GO_VERSION))
|
||||
BETA_URL := http://beta.rclone.org/$(TAG)/
|
||||
# Only needed for Go 1.5
|
||||
export GO15VENDOREXPERIMENT=1
|
||||
BETA_URL := https://beta.rclone.org/$(TAG)/
|
||||
# Pass in GOTAGS=xyz on the make command line to set build tags
|
||||
ifdef GOTAGS
|
||||
BUILDTAGS=-tags "$(GOTAGS)"
|
||||
endif
|
||||
|
||||
.PHONY: rclone
|
||||
.PHONY: rclone vars version
|
||||
|
||||
rclone:
|
||||
touch fs/version.go
|
||||
go install -v --ldflags "-s -X github.com/ncw/rclone/fs.Version=$(TAG)"
|
||||
go install -v --ldflags "-s -X github.com/ncw/rclone/fs.Version=$(TAG)" $(BUILDTAGS)
|
||||
cp -av `go env GOPATH`/bin/rclone .
|
||||
|
||||
vars:
|
||||
@@ -25,21 +27,26 @@ vars:
|
||||
@echo GO_LATEST="'$(GO_LATEST)'"
|
||||
@echo BETA_URL="'$(BETA_URL)'"
|
||||
|
||||
version:
|
||||
@echo '$(TAG)'
|
||||
|
||||
# Full suite of integration tests
|
||||
test: rclone
|
||||
go test $(GO_FILES)
|
||||
cd fs && go run test_all.go
|
||||
go test $(BUILDTAGS) $(GO_FILES)
|
||||
cd fs && go run $(BUILDTAGS) test_all.go
|
||||
|
||||
# Quick test
|
||||
quicktest:
|
||||
RCLONE_CONFIG="/notfound" go test $(GO_FILES)
|
||||
RCLONE_CONFIG="/notfound" go test -cpu=2 -race $(GO_FILES)
|
||||
RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) $(GO_FILES)
|
||||
ifdef GO_LATEST
|
||||
RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) -cpu=2 -race $(GO_FILES)
|
||||
endif
|
||||
|
||||
# Do source code quality checks
|
||||
check: rclone
|
||||
ifdef GO_LATEST
|
||||
go tool vet -printfuncs Debugf,Infof,Logf,Errorf . 2>&1 | grep -E -v vendor/ ; test $$? -eq 1
|
||||
errcheck $(GO_FILES)
|
||||
go tool vet $(BUILDTAGS) -printfuncs Debugf,Infof,Logf,Errorf . 2>&1 | grep -E -v vendor/ ; test $$? -eq 1
|
||||
errcheck $(BUILDTAGS) $(GO_FILES)
|
||||
find . -name \*.go | grep -v /vendor/ | xargs goimports -d | grep . ; test $$? -eq 1
|
||||
go list ./... | grep -v /vendor/ | xargs -i golint {} | grep -E -v '(StorageUrl|CdnUrl)' ; test $$? -eq 1
|
||||
else
|
||||
@@ -58,9 +65,7 @@ endif
|
||||
|
||||
# Update dependencies
|
||||
update:
|
||||
rm -rf Godeps vendor
|
||||
go get -t -u -f -v ./...
|
||||
godep save ./...
|
||||
dep ensure -update -v
|
||||
|
||||
doc: rclone.1 MANUAL.html MANUAL.txt
|
||||
|
||||
@@ -102,20 +107,34 @@ upload_github:
|
||||
./bin/upload-github $(TAG)
|
||||
|
||||
cross: doc
|
||||
go run bin/cross-compile.go -release current $(TAG)
|
||||
go run bin/cross-compile.go -release current $(BUILDTAGS) $(TAG)
|
||||
|
||||
beta:
|
||||
go run bin/cross-compile.go $(TAG)β
|
||||
go run bin/cross-compile.go $(BUILDTAGS) $(TAG)β
|
||||
rclone -v copy build/ memstore:pub-rclone-org/$(TAG)β
|
||||
@echo Beta release ready at http://pub.rclone.org/$(TAG)%CE%B2/
|
||||
@echo Beta release ready at https://pub.rclone.org/$(TAG)%CE%B2/
|
||||
|
||||
travis_beta:
|
||||
git log $(LAST_TAG).. > /tmp/git-log.txt
|
||||
go run bin/cross-compile.go -release beta-latest -git-log /tmp/git-log.txt $(TAG)β
|
||||
log_since_last_release:
|
||||
git log $(LAST_TAG)..
|
||||
|
||||
upload_beta:
|
||||
rclone --config bin/travis.rclone.conf -v copy --exclude '*beta-latest*' build/ memstore:beta-rclone-org/$(TAG)
|
||||
rclone --config bin/travis.rclone.conf -v copy --include '*beta-latest*' build/ memstore:beta-rclone-org
|
||||
@echo Beta release ready at $(BETA_URL)
|
||||
|
||||
travis_beta:
|
||||
git log $(LAST_TAG).. > /tmp/git-log.txt
|
||||
go run bin/cross-compile.go -release beta-latest -git-log /tmp/git-log.txt -exclude "^windows/" -parallel 8 $(BUILDTAGS) $(TAG)β
|
||||
rclone --config bin/travis.rclone.conf -v copy --exclude '*beta-latest*' build/ memstore:beta-rclone-org/$(TAG)
|
||||
rclone --config bin/travis.rclone.conf -v copy --include '*beta-latest*' build/ memstore:beta-rclone-org
|
||||
@echo Beta release ready at $(BETA_URL)
|
||||
|
||||
# Fetch the windows builds from appveyor
|
||||
fetch_windows:
|
||||
rclone -v copy --include 'rclone-v*-windows-*.zip' memstore:beta-rclone-org build/$(TAG) build/
|
||||
cp -av rclone-v*-windows-*.zip rclone-current-windows-386.zip
|
||||
cp -av rclone-v*-windows-*.zip rclone-current-windows-amd64.zip
|
||||
|
||||
serve: website
|
||||
cd docs && hugo server -v -w
|
||||
|
||||
@@ -134,8 +153,14 @@ tag: doc
|
||||
|
||||
retag:
|
||||
git tag -f $(LAST_TAG)
|
||||
|
||||
startdev:
|
||||
echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(LAST_TAG)-DEV\"\n" | gofmt > fs/version.go
|
||||
git commit -m "Start $(LAST_TAG)-DEV development" fs/version.go
|
||||
|
||||
gen_tests:
|
||||
cd fstest/fstests && go generate
|
||||
|
||||
winzip:
|
||||
zip -9 rclone-$(TAG).zip rclone.exe
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
[](http://rclone.org/)
|
||||
[](https://rclone.org/)
|
||||
|
||||
[Website](http://rclone.org) |
|
||||
[Documentation](http://rclone.org/docs/) |
|
||||
[Website](https://rclone.org) |
|
||||
[Documentation](https://rclone.org/docs/) |
|
||||
[Contributing](CONTRIBUTING.md) |
|
||||
[Changelog](http://rclone.org/changelog/) |
|
||||
[Installation](http://rclone.org/install/) |
|
||||
[Changelog](https://rclone.org/changelog/) |
|
||||
[Installation](https://rclone.org/install/) |
|
||||
[Forum](https://forum.rclone.org/)
|
||||
[G+](https://google.com/+RcloneOrg)
|
||||
|
||||
|
||||
[](https://travis-ci.org/ncw/rclone) [](https://ci.appveyor.com/project/ncw/rclone) [](https://godoc.org/github.com/ncw/rclone)
|
||||
[](https://travis-ci.org/ncw/rclone)
|
||||
[](https://ci.appveyor.com/project/ncw/rclone)
|
||||
[](https://circleci.com/gh/ncw/rclone/tree/master)
|
||||
[](https://godoc.org/github.com/ncw/rclone)
|
||||
|
||||
Rclone is a command line program to sync files and directories to and from
|
||||
|
||||
@@ -19,11 +21,13 @@ Rclone is a command line program to sync files and directories to and from
|
||||
* Dropbox
|
||||
* Google Cloud Storage
|
||||
* Amazon Drive
|
||||
* Microsoft One Drive
|
||||
* Microsoft OneDrive
|
||||
* Hubic
|
||||
* Backblaze B2
|
||||
* Yandex Disk
|
||||
* SFTP
|
||||
* FTP
|
||||
* HTTP
|
||||
* The local filesystem
|
||||
|
||||
Features
|
||||
@@ -41,7 +45,7 @@ Features
|
||||
See the home page for installation, usage, documentation, changelog
|
||||
and configuration walkthroughs.
|
||||
|
||||
* http://rclone.org/
|
||||
* https://rclone.org/
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
+6
-2
@@ -16,11 +16,15 @@ Making a release
|
||||
* make retag
|
||||
* # Set the GOPATH for a current stable go compiler
|
||||
* make cross
|
||||
* make upload
|
||||
* make upload_website
|
||||
* git push --tags origin master
|
||||
* git push --tags origin master:stable # update the stable branch for packager.io
|
||||
* # Wait for the appveyor and travis builds to complete then fetch the windows binaries from appveyor
|
||||
* make fetch_windows
|
||||
* make upload
|
||||
* make upload_website
|
||||
* make upload_github
|
||||
* make startdev
|
||||
* # announce with forum post, twitter post, G+ post
|
||||
|
||||
Early in the next release cycle update the vendored dependencies
|
||||
* make update
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
package amazonclouddrive
|
||||
|
||||
/*
|
||||
|
||||
FIXME make searching for directory in id and file in id more efficient
|
||||
- use the name: search parameter - remember the escaping rules
|
||||
- use Folder GetNode and GetFile
|
||||
@@ -34,15 +33,13 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
rcloneClientID = "amzn1.application-oa2-client.6bf18d2d1f5b485c94c8988bb03ad0e7"
|
||||
rcloneEncryptedClientSecret = "ZP12wYlGw198FtmqfOxyNAGXU3fwVcQdmt--ba1d00wJnUs0LOzvVyXVDbqhbcUqnr5Vd1QejwWmiv1Ep7UJG1kUQeuBP5n9goXWd5MrAf0"
|
||||
folderKind = "FOLDER"
|
||||
fileKind = "FILE"
|
||||
assetKind = "ASSET"
|
||||
statusAvailable = "AVAILABLE"
|
||||
timeFormat = time.RFC3339 // 2014-03-07T22:31:12.173Z
|
||||
minSleep = 20 * time.Millisecond
|
||||
warnFileSize = 50000 << 20 // Display warning for files larger than this size
|
||||
folderKind = "FOLDER"
|
||||
fileKind = "FILE"
|
||||
assetKind = "ASSET"
|
||||
statusAvailable = "AVAILABLE"
|
||||
timeFormat = time.RFC3339 // 2014-03-07T22:31:12.173Z
|
||||
minSleep = 20 * time.Millisecond
|
||||
warnFileSize = 50000 << 20 // Display warning for files larger than this size
|
||||
)
|
||||
|
||||
// Globals
|
||||
@@ -57,8 +54,8 @@ var (
|
||||
AuthURL: "https://www.amazon.com/ap/oa",
|
||||
TokenURL: "https://api.amazon.com/auth/o2/token",
|
||||
},
|
||||
ClientID: rcloneClientID,
|
||||
ClientSecret: fs.MustReveal(rcloneEncryptedClientSecret),
|
||||
ClientID: "",
|
||||
ClientSecret: "",
|
||||
RedirectURL: oauthutil.RedirectURL,
|
||||
}
|
||||
)
|
||||
@@ -77,10 +74,16 @@ func init() {
|
||||
},
|
||||
Options: []fs.Option{{
|
||||
Name: fs.ConfigClientID,
|
||||
Help: "Amazon Application Client Id - leave blank normally.",
|
||||
Help: "Amazon Application Client Id - required.",
|
||||
}, {
|
||||
Name: fs.ConfigClientSecret,
|
||||
Help: "Amazon Application Client Secret - leave blank normally.",
|
||||
Help: "Amazon Application Client Secret - required.",
|
||||
}, {
|
||||
Name: fs.ConfigAuthURL,
|
||||
Help: "Auth server URL - leave blank to use Amazon's.",
|
||||
}, {
|
||||
Name: fs.ConfigTokenURL,
|
||||
Help: "Token server url - leave blank to use Amazon's.",
|
||||
}},
|
||||
})
|
||||
fs.VarP(&tempLinkThreshold, "acd-templink-threshold", "", "Files >= this size will be downloaded via their tempLink.")
|
||||
@@ -189,6 +192,12 @@ func NewFs(name, root string) (fs.Fs, error) {
|
||||
}
|
||||
f.features = (&fs.Features{CaseInsensitive: true, ReadMimeType: true}).Fill(f)
|
||||
|
||||
// Renew the token in the background
|
||||
f.tokenRenewer = oauthutil.NewRenew(f.String(), ts, func() error {
|
||||
_, err := f.getRootInfo()
|
||||
return err
|
||||
})
|
||||
|
||||
// Update endpoints
|
||||
var resp *http.Response
|
||||
err = f.pacer.Call(func() (bool, error) {
|
||||
@@ -206,12 +215,6 @@ func NewFs(name, root string) (fs.Fs, error) {
|
||||
}
|
||||
f.trueRootID = *rootInfo.Id
|
||||
|
||||
// Renew the token in the background
|
||||
f.tokenRenewer = oauthutil.NewRenew(f.String(), ts, func() error {
|
||||
_, err := f.getRootInfo()
|
||||
return err
|
||||
})
|
||||
|
||||
f.dirCache = dircache.New(root, f.trueRootID, f)
|
||||
|
||||
// Find the current root
|
||||
@@ -395,45 +398,54 @@ func (f *Fs) listAll(dirID string, title string, directoriesOnly bool, filesOnly
|
||||
return
|
||||
}
|
||||
|
||||
// ListDir reads the directory specified by the job into out, returning any more jobs
|
||||
func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.ListDirJob, err error) {
|
||||
fs.Debugf(f, "Reading %q", job.Path)
|
||||
// List the objects and directories in dir into entries. The
|
||||
// entries can be returned in any order but should be for a
|
||||
// complete directory.
|
||||
//
|
||||
// dir should be "" to list the root, and should not have
|
||||
// trailing slashes.
|
||||
//
|
||||
// This should return ErrDirNotFound if the directory isn't
|
||||
// found.
|
||||
func (f *Fs) List(dir string) (entries fs.DirEntries, err error) {
|
||||
err = f.dirCache.FindRoot(false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
directoryID, err := f.dirCache.FindDir(dir, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
maxTries := fs.Config.LowLevelRetries
|
||||
var iErr error
|
||||
for tries := 1; tries <= maxTries; tries++ {
|
||||
_, err = f.listAll(job.DirID, "", false, false, func(node *acd.Node) bool {
|
||||
remote := job.Path + *node.Name
|
||||
entries = nil
|
||||
_, err = f.listAll(directoryID, "", false, false, func(node *acd.Node) bool {
|
||||
remote := path.Join(dir, *node.Name)
|
||||
switch *node.Kind {
|
||||
case folderKind:
|
||||
if out.IncludeDirectory(remote) {
|
||||
dir := &fs.Dir{
|
||||
Name: remote,
|
||||
Bytes: -1,
|
||||
Count: -1,
|
||||
}
|
||||
dir.When, _ = time.Parse(timeFormat, *node.ModifiedDate) // FIXME
|
||||
if out.AddDir(dir) {
|
||||
return true
|
||||
}
|
||||
if job.Depth > 0 {
|
||||
jobs = append(jobs, dircache.ListDirJob{DirID: *node.Id, Path: remote + "/", Depth: job.Depth - 1})
|
||||
}
|
||||
}
|
||||
// cache the directory ID for later lookups
|
||||
f.dirCache.Put(remote, *node.Id)
|
||||
when, _ := time.Parse(timeFormat, *node.ModifiedDate) // FIXME
|
||||
d := fs.NewDir(remote, when)
|
||||
entries = append(entries, d)
|
||||
case fileKind:
|
||||
o, err := f.newObjectWithInfo(remote, node)
|
||||
if err != nil {
|
||||
out.SetError(err)
|
||||
return true
|
||||
}
|
||||
if out.Add(o) {
|
||||
iErr = err
|
||||
return true
|
||||
}
|
||||
entries = append(entries, o)
|
||||
default:
|
||||
// ignore ASSET etc
|
||||
}
|
||||
return false
|
||||
})
|
||||
if iErr != nil {
|
||||
return nil, iErr
|
||||
}
|
||||
if fs.IsRetryError(err) {
|
||||
fs.Debugf(f, "Directory listing error for %q: %v - low level retry %d/%d", job.Path, err, tries, maxTries)
|
||||
fs.Debugf(f, "Directory listing error for %q: %v - low level retry %d/%d", dir, err, tries, maxTries)
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
@@ -441,13 +453,7 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
|
||||
}
|
||||
break
|
||||
}
|
||||
fs.Debugf(f, "Finished reading %q", job.Path)
|
||||
return jobs, err
|
||||
}
|
||||
|
||||
// List walks the path returning iles and directories into out
|
||||
func (f *Fs) List(out fs.ListOpts, dir string) {
|
||||
f.dirCache.List(f, out, dir)
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
// checkUpload checks to see if an error occurred after the file was
|
||||
@@ -534,7 +540,7 @@ func (f *Fs) checkUpload(resp *http.Response, in io.Reader, src fs.ObjectInfo, i
|
||||
// Copy the reader in to the new object which is returned
|
||||
//
|
||||
// The new object may have been created if an error is returned
|
||||
func (f *Fs) Put(in io.Reader, src fs.ObjectInfo) (fs.Object, error) {
|
||||
func (f *Fs) Put(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
|
||||
remote := src.Remote()
|
||||
size := src.Size()
|
||||
// Temporary Object under construction
|
||||
@@ -983,7 +989,7 @@ func (o *Object) Storable() bool {
|
||||
func (o *Object) Open(options ...fs.OpenOption) (in io.ReadCloser, err error) {
|
||||
bigObject := o.Size() >= int64(tempLinkThreshold)
|
||||
if bigObject {
|
||||
fs.Debugf(o, "Dowloading large object via tempLink")
|
||||
fs.Debugf(o, "Downloading large object via tempLink")
|
||||
}
|
||||
file := acd.File{Node: o.info}
|
||||
var resp *http.Response
|
||||
@@ -1002,7 +1008,7 @@ func (o *Object) Open(options ...fs.OpenOption) (in io.ReadCloser, err error) {
|
||||
// Update the object with the contents of the io.Reader, modTime and size
|
||||
//
|
||||
// The new object may have been created if an error is returned
|
||||
func (o *Object) Update(in io.Reader, src fs.ObjectInfo) error {
|
||||
func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error {
|
||||
file := acd.File{Node: o.info}
|
||||
var info *acd.File
|
||||
var resp *http.Response
|
||||
|
||||
@@ -20,30 +20,38 @@ func TestSetup(t *testing.T) {
|
||||
// Generic tests for the Fs
|
||||
func TestInit(t *testing.T) { fstests.TestInit(t) }
|
||||
func TestFsString(t *testing.T) { fstests.TestFsString(t) }
|
||||
func TestFsName(t *testing.T) { fstests.TestFsName(t) }
|
||||
func TestFsRoot(t *testing.T) { fstests.TestFsRoot(t) }
|
||||
func TestFsRmdirEmpty(t *testing.T) { fstests.TestFsRmdirEmpty(t) }
|
||||
func TestFsRmdirNotFound(t *testing.T) { fstests.TestFsRmdirNotFound(t) }
|
||||
func TestFsMkdir(t *testing.T) { fstests.TestFsMkdir(t) }
|
||||
func TestFsMkdirRmdirSubdir(t *testing.T) { fstests.TestFsMkdirRmdirSubdir(t) }
|
||||
func TestFsListEmpty(t *testing.T) { fstests.TestFsListEmpty(t) }
|
||||
func TestFsListDirEmpty(t *testing.T) { fstests.TestFsListDirEmpty(t) }
|
||||
func TestFsListRDirEmpty(t *testing.T) { fstests.TestFsListRDirEmpty(t) }
|
||||
func TestFsNewObjectNotFound(t *testing.T) { fstests.TestFsNewObjectNotFound(t) }
|
||||
func TestFsPutFile1(t *testing.T) { fstests.TestFsPutFile1(t) }
|
||||
func TestFsPutError(t *testing.T) { fstests.TestFsPutError(t) }
|
||||
func TestFsPutFile2(t *testing.T) { fstests.TestFsPutFile2(t) }
|
||||
func TestFsUpdateFile1(t *testing.T) { fstests.TestFsUpdateFile1(t) }
|
||||
func TestFsListDirFile2(t *testing.T) { fstests.TestFsListDirFile2(t) }
|
||||
func TestFsListRDirFile2(t *testing.T) { fstests.TestFsListRDirFile2(t) }
|
||||
func TestFsListDirRoot(t *testing.T) { fstests.TestFsListDirRoot(t) }
|
||||
func TestFsListRDirRoot(t *testing.T) { fstests.TestFsListRDirRoot(t) }
|
||||
func TestFsListSubdir(t *testing.T) { fstests.TestFsListSubdir(t) }
|
||||
func TestFsListRSubdir(t *testing.T) { fstests.TestFsListRSubdir(t) }
|
||||
func TestFsListLevel2(t *testing.T) { fstests.TestFsListLevel2(t) }
|
||||
func TestFsListRLevel2(t *testing.T) { fstests.TestFsListRLevel2(t) }
|
||||
func TestFsListFile1(t *testing.T) { fstests.TestFsListFile1(t) }
|
||||
func TestFsNewObject(t *testing.T) { fstests.TestFsNewObject(t) }
|
||||
func TestFsNewObjectDir(t *testing.T) { fstests.TestFsNewObjectDir(t) }
|
||||
func TestFsListFile1and2(t *testing.T) { fstests.TestFsListFile1and2(t) }
|
||||
func TestFsNewObjectDir(t *testing.T) { fstests.TestFsNewObjectDir(t) }
|
||||
func TestFsCopy(t *testing.T) { fstests.TestFsCopy(t) }
|
||||
func TestFsMove(t *testing.T) { fstests.TestFsMove(t) }
|
||||
func TestFsDirMove(t *testing.T) { fstests.TestFsDirMove(t) }
|
||||
func TestFsRmdirFull(t *testing.T) { fstests.TestFsRmdirFull(t) }
|
||||
func TestFsPrecision(t *testing.T) { fstests.TestFsPrecision(t) }
|
||||
func TestFsDirChangeNotify(t *testing.T) { fstests.TestFsDirChangeNotify(t) }
|
||||
func TestObjectString(t *testing.T) { fstests.TestObjectString(t) }
|
||||
func TestObjectFs(t *testing.T) { fstests.TestObjectFs(t) }
|
||||
func TestObjectRemote(t *testing.T) { fstests.TestObjectRemote(t) }
|
||||
@@ -54,6 +62,7 @@ func TestObjectSetModTime(t *testing.T) { fstests.TestObjectSetModTime(t) }
|
||||
func TestObjectSize(t *testing.T) { fstests.TestObjectSize(t) }
|
||||
func TestObjectOpen(t *testing.T) { fstests.TestObjectOpen(t) }
|
||||
func TestObjectOpenSeek(t *testing.T) { fstests.TestObjectOpenSeek(t) }
|
||||
func TestObjectPartialRead(t *testing.T) { fstests.TestObjectPartialRead(t) }
|
||||
func TestObjectUpdate(t *testing.T) { fstests.TestObjectUpdate(t) }
|
||||
func TestObjectStorable(t *testing.T) { fstests.TestObjectStorable(t) }
|
||||
func TestFsIsFile(t *testing.T) { fstests.TestFsIsFile(t) }
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
version: "{build}"
|
||||
|
||||
os: Windows Server 2012 R2
|
||||
|
||||
clone_folder: c:\gopath\src\github.com\ncw\rclone
|
||||
|
||||
environment:
|
||||
GOPATH: c:\gopath
|
||||
|
||||
install:
|
||||
- echo %PATH%
|
||||
- echo %GOPATH%
|
||||
- go version
|
||||
- go env
|
||||
- go install
|
||||
|
||||
build_script:
|
||||
- rmdir vendor\bazil.org\fuse /s /q
|
||||
- go test -cpu=2 ./...
|
||||
- go test -cpu=2 -short -race ./...
|
||||
@@ -46,7 +46,7 @@ const (
|
||||
|
||||
// Globals
|
||||
var (
|
||||
minChunkSize = fs.SizeSuffix(100E6)
|
||||
minChunkSize = fs.SizeSuffix(5E6)
|
||||
chunkSize = fs.SizeSuffix(96 * 1024 * 1024)
|
||||
uploadCutoff = fs.SizeSuffix(200E6)
|
||||
b2TestMode = fs.StringP("b2-test-mode", "", "", "A flag string for X-Bz-Test-Mode header.")
|
||||
@@ -86,6 +86,8 @@ type Fs struct {
|
||||
endpoint string // name of the starting api endpoint
|
||||
srv *rest.Client // the connection to the b2 server
|
||||
bucket string // the bucket we are working on
|
||||
bucketOKMu sync.Mutex // mutex to protect bucket OK
|
||||
bucketOK bool // true if we have created the bucket
|
||||
bucketIDMutex sync.Mutex // mutex to protect _bucketID
|
||||
_bucketID string // the ID of the bucket we are working on
|
||||
info api.AuthorizeAccountResponse // result of authorize call
|
||||
@@ -436,18 +438,14 @@ var errEndList = errors.New("end list")
|
||||
// than 1000)
|
||||
//
|
||||
// If hidden is set then it will list the hidden (deleted) files too.
|
||||
func (f *Fs) list(dir string, level int, prefix string, limit int, hidden bool, fn listFn) error {
|
||||
func (f *Fs) list(dir string, recurse bool, prefix string, limit int, hidden bool, fn listFn) error {
|
||||
root := f.root
|
||||
if dir != "" {
|
||||
root += dir + "/"
|
||||
}
|
||||
delimiter := ""
|
||||
switch level {
|
||||
case 1:
|
||||
if !recurse {
|
||||
delimiter = "/"
|
||||
case fs.MaxLevel:
|
||||
default:
|
||||
return fs.ErrorLevelNotSupported
|
||||
}
|
||||
bucketID, err := f.getBucketID()
|
||||
if err != nil {
|
||||
@@ -495,7 +493,7 @@ func (f *Fs) list(dir string, level int, prefix string, limit int, hidden bool,
|
||||
}
|
||||
remote := file.Name[len(f.root):]
|
||||
// Check for directory
|
||||
isDirectory := level != 0 && strings.HasSuffix(remote, "/")
|
||||
isDirectory := strings.HasSuffix(remote, "/")
|
||||
if isDirectory {
|
||||
remote = remote[:len(remote)-1]
|
||||
}
|
||||
@@ -520,77 +518,112 @@ func (f *Fs) list(dir string, level int, prefix string, limit int, hidden bool,
|
||||
return nil
|
||||
}
|
||||
|
||||
// listFiles walks the path returning files and directories to out
|
||||
func (f *Fs) listFiles(out fs.ListOpts, dir string) {
|
||||
defer out.Finished()
|
||||
// List the objects
|
||||
// Convert a list item into a DirEntry
|
||||
func (f *Fs) itemToDirEntry(remote string, object *api.File, isDirectory bool, last *string) (fs.DirEntry, error) {
|
||||
if isDirectory {
|
||||
d := fs.NewDir(remote, time.Time{})
|
||||
return d, nil
|
||||
}
|
||||
if remote == *last {
|
||||
remote = object.UploadTimestamp.AddVersion(remote)
|
||||
} else {
|
||||
*last = remote
|
||||
}
|
||||
// hide objects represent deleted files which we don't list
|
||||
if object.Action == "hide" {
|
||||
return nil, nil
|
||||
}
|
||||
o, err := f.newObjectWithInfo(remote, object)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return o, nil
|
||||
}
|
||||
|
||||
// listDir lists a single directory
|
||||
func (f *Fs) listDir(dir string) (entries fs.DirEntries, err error) {
|
||||
last := ""
|
||||
err := f.list(dir, out.Level(), "", 0, *b2Versions, func(remote string, object *api.File, isDirectory bool) error {
|
||||
if isDirectory {
|
||||
dir := &fs.Dir{
|
||||
Name: remote,
|
||||
Bytes: -1,
|
||||
Count: -1,
|
||||
}
|
||||
if out.AddDir(dir) {
|
||||
return fs.ErrorListAborted
|
||||
}
|
||||
} else {
|
||||
if remote == last {
|
||||
remote = object.UploadTimestamp.AddVersion(remote)
|
||||
} else {
|
||||
last = remote
|
||||
}
|
||||
// hide objects represent deleted files which we don't list
|
||||
if object.Action == "hide" {
|
||||
return nil
|
||||
}
|
||||
o, err := f.newObjectWithInfo(remote, object)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if out.Add(o) {
|
||||
return fs.ErrorListAborted
|
||||
}
|
||||
err = f.list(dir, false, "", 0, *b2Versions, func(remote string, object *api.File, isDirectory bool) error {
|
||||
entry, err := f.itemToDirEntry(remote, object, isDirectory, &last)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if entry != nil {
|
||||
entries = append(entries, entry)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
out.SetError(err)
|
||||
return nil, err
|
||||
}
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
// listBuckets returns all the buckets to out
|
||||
func (f *Fs) listBuckets(out fs.ListOpts, dir string) {
|
||||
defer out.Finished()
|
||||
func (f *Fs) listBuckets(dir string) (entries fs.DirEntries, err error) {
|
||||
if dir != "" {
|
||||
out.SetError(fs.ErrorListOnlyRoot)
|
||||
return
|
||||
return nil, fs.ErrorListBucketRequired
|
||||
}
|
||||
err := f.listBucketsToFn(func(bucket *api.Bucket) error {
|
||||
dir := &fs.Dir{
|
||||
Name: bucket.Name,
|
||||
Bytes: -1,
|
||||
Count: -1,
|
||||
}
|
||||
if out.AddDir(dir) {
|
||||
return fs.ErrorListAborted
|
||||
}
|
||||
err = f.listBucketsToFn(func(bucket *api.Bucket) error {
|
||||
d := fs.NewDir(bucket.Name, time.Time{})
|
||||
entries = append(entries, d)
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
out.SetError(err)
|
||||
return nil, err
|
||||
}
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
// List walks the path returning files and directories to out
|
||||
func (f *Fs) List(out fs.ListOpts, dir string) {
|
||||
// List the objects and directories in dir into entries. The
|
||||
// entries can be returned in any order but should be for a
|
||||
// complete directory.
|
||||
//
|
||||
// dir should be "" to list the root, and should not have
|
||||
// trailing slashes.
|
||||
//
|
||||
// This should return ErrDirNotFound if the directory isn't
|
||||
// found.
|
||||
func (f *Fs) List(dir string) (entries fs.DirEntries, err error) {
|
||||
if f.bucket == "" {
|
||||
f.listBuckets(out, dir)
|
||||
} else {
|
||||
f.listFiles(out, dir)
|
||||
return f.listBuckets(dir)
|
||||
}
|
||||
return
|
||||
return f.listDir(dir)
|
||||
}
|
||||
|
||||
// ListR lists the objects and directories of the Fs starting
|
||||
// from dir recursively into out.
|
||||
//
|
||||
// dir should be "" to start from the root, and should not
|
||||
// have trailing slashes.
|
||||
//
|
||||
// This should return ErrDirNotFound if the directory isn't
|
||||
// found.
|
||||
//
|
||||
// It should call callback for each tranche of entries read.
|
||||
// These need not be returned in any particular order. If
|
||||
// callback returns an error then the listing will stop
|
||||
// immediately.
|
||||
//
|
||||
// Don't implement this unless you have a more efficient way
|
||||
// of listing recursively that doing a directory traversal.
|
||||
func (f *Fs) ListR(dir string, callback fs.ListRCallback) (err error) {
|
||||
if f.bucket == "" {
|
||||
return fs.ErrorListBucketRequired
|
||||
}
|
||||
list := fs.NewListRHelper(callback)
|
||||
last := ""
|
||||
err = f.list(dir, true, "", 0, *b2Versions, func(remote string, object *api.File, isDirectory bool) error {
|
||||
entry, err := f.itemToDirEntry(remote, object, isDirectory, &last)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return list.Add(entry)
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return list.Flush()
|
||||
}
|
||||
|
||||
// listBucketFn is called from listBucketsToFn to handle a bucket
|
||||
@@ -660,7 +693,7 @@ func (f *Fs) clearBucketID() {
|
||||
// Copy the reader in to the new object which is returned
|
||||
//
|
||||
// The new object may have been created if an error is returned
|
||||
func (f *Fs) Put(in io.Reader, src fs.ObjectInfo) (fs.Object, error) {
|
||||
func (f *Fs) Put(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
|
||||
// Temporary Object under construction
|
||||
fs := &Object{
|
||||
fs: f,
|
||||
@@ -671,8 +704,9 @@ func (f *Fs) Put(in io.Reader, src fs.ObjectInfo) (fs.Object, error) {
|
||||
|
||||
// Mkdir creates the bucket if it doesn't exist
|
||||
func (f *Fs) Mkdir(dir string) error {
|
||||
// Can't create subdirs
|
||||
if dir != "" {
|
||||
f.bucketOKMu.Lock()
|
||||
defer f.bucketOKMu.Unlock()
|
||||
if f.bucketOK {
|
||||
return nil
|
||||
}
|
||||
opts := rest.Opts{
|
||||
@@ -697,6 +731,7 @@ func (f *Fs) Mkdir(dir string) error {
|
||||
_, getBucketErr := f.getBucketID()
|
||||
if getBucketErr == nil {
|
||||
// found so it is our bucket
|
||||
f.bucketOK = true
|
||||
return nil
|
||||
}
|
||||
if getBucketErr != fs.ErrorDirNotFound {
|
||||
@@ -707,6 +742,7 @@ func (f *Fs) Mkdir(dir string) error {
|
||||
return errors.Wrap(err, "failed to create bucket")
|
||||
}
|
||||
f.setBucketID(response.ID)
|
||||
f.bucketOK = true
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -714,6 +750,8 @@ func (f *Fs) Mkdir(dir string) error {
|
||||
//
|
||||
// Returns an error if it isn't empty
|
||||
func (f *Fs) Rmdir(dir string) error {
|
||||
f.bucketOKMu.Lock()
|
||||
defer f.bucketOKMu.Unlock()
|
||||
if f.root != "" || dir != "" {
|
||||
return nil
|
||||
}
|
||||
@@ -737,6 +775,7 @@ func (f *Fs) Rmdir(dir string) error {
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to delete bucket")
|
||||
}
|
||||
f.bucketOK = false
|
||||
f.clearBucketID()
|
||||
f.clearUploadURL()
|
||||
return nil
|
||||
@@ -802,7 +841,7 @@ func (f *Fs) purge(oldOnly bool) error {
|
||||
}()
|
||||
}
|
||||
last := ""
|
||||
checkErr(f.list("", fs.MaxLevel, "", 0, true, func(remote string, object *api.File, isDirectory bool) error {
|
||||
checkErr(f.list("", true, "", 0, true, func(remote string, object *api.File, isDirectory bool) error {
|
||||
if !isDirectory {
|
||||
fs.Stats.Checking(remote)
|
||||
if oldOnly && last != remote {
|
||||
@@ -947,7 +986,7 @@ func (o *Object) readMetaData() (err error) {
|
||||
maxSearched = maxVersions
|
||||
}
|
||||
var info *api.File
|
||||
err = o.fs.list("", fs.MaxLevel, baseRemote, maxSearched, *b2Versions, func(remote string, object *api.File, isDirectory bool) error {
|
||||
err = o.fs.list("", true, baseRemote, maxSearched, *b2Versions, func(remote string, object *api.File, isDirectory bool) error {
|
||||
if isDirectory {
|
||||
return nil
|
||||
}
|
||||
@@ -1161,10 +1200,14 @@ func urlEncode(in string) string {
|
||||
// Update the object with the contents of the io.Reader, modTime and size
|
||||
//
|
||||
// The new object may have been created if an error is returned
|
||||
func (o *Object) Update(in io.Reader, src fs.ObjectInfo) (err error) {
|
||||
func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {
|
||||
if *b2Versions {
|
||||
return errNotWithVersions
|
||||
}
|
||||
err = o.fs.Mkdir("")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
size := src.Size()
|
||||
|
||||
// If a large file upload in chunks - see upload.go
|
||||
@@ -1353,6 +1396,7 @@ var (
|
||||
_ fs.Fs = &Fs{}
|
||||
_ fs.Purger = &Fs{}
|
||||
_ fs.CleanUpper = &Fs{}
|
||||
_ fs.ListRer = &Fs{}
|
||||
_ fs.Object = &Object{}
|
||||
_ fs.MimeTyper = &Object{}
|
||||
)
|
||||
+10
-1
@@ -20,30 +20,38 @@ func TestSetup(t *testing.T) {
|
||||
// Generic tests for the Fs
|
||||
func TestInit(t *testing.T) { fstests.TestInit(t) }
|
||||
func TestFsString(t *testing.T) { fstests.TestFsString(t) }
|
||||
func TestFsName(t *testing.T) { fstests.TestFsName(t) }
|
||||
func TestFsRoot(t *testing.T) { fstests.TestFsRoot(t) }
|
||||
func TestFsRmdirEmpty(t *testing.T) { fstests.TestFsRmdirEmpty(t) }
|
||||
func TestFsRmdirNotFound(t *testing.T) { fstests.TestFsRmdirNotFound(t) }
|
||||
func TestFsMkdir(t *testing.T) { fstests.TestFsMkdir(t) }
|
||||
func TestFsMkdirRmdirSubdir(t *testing.T) { fstests.TestFsMkdirRmdirSubdir(t) }
|
||||
func TestFsListEmpty(t *testing.T) { fstests.TestFsListEmpty(t) }
|
||||
func TestFsListDirEmpty(t *testing.T) { fstests.TestFsListDirEmpty(t) }
|
||||
func TestFsListRDirEmpty(t *testing.T) { fstests.TestFsListRDirEmpty(t) }
|
||||
func TestFsNewObjectNotFound(t *testing.T) { fstests.TestFsNewObjectNotFound(t) }
|
||||
func TestFsPutFile1(t *testing.T) { fstests.TestFsPutFile1(t) }
|
||||
func TestFsPutError(t *testing.T) { fstests.TestFsPutError(t) }
|
||||
func TestFsPutFile2(t *testing.T) { fstests.TestFsPutFile2(t) }
|
||||
func TestFsUpdateFile1(t *testing.T) { fstests.TestFsUpdateFile1(t) }
|
||||
func TestFsListDirFile2(t *testing.T) { fstests.TestFsListDirFile2(t) }
|
||||
func TestFsListRDirFile2(t *testing.T) { fstests.TestFsListRDirFile2(t) }
|
||||
func TestFsListDirRoot(t *testing.T) { fstests.TestFsListDirRoot(t) }
|
||||
func TestFsListRDirRoot(t *testing.T) { fstests.TestFsListRDirRoot(t) }
|
||||
func TestFsListSubdir(t *testing.T) { fstests.TestFsListSubdir(t) }
|
||||
func TestFsListRSubdir(t *testing.T) { fstests.TestFsListRSubdir(t) }
|
||||
func TestFsListLevel2(t *testing.T) { fstests.TestFsListLevel2(t) }
|
||||
func TestFsListRLevel2(t *testing.T) { fstests.TestFsListRLevel2(t) }
|
||||
func TestFsListFile1(t *testing.T) { fstests.TestFsListFile1(t) }
|
||||
func TestFsNewObject(t *testing.T) { fstests.TestFsNewObject(t) }
|
||||
func TestFsNewObjectDir(t *testing.T) { fstests.TestFsNewObjectDir(t) }
|
||||
func TestFsListFile1and2(t *testing.T) { fstests.TestFsListFile1and2(t) }
|
||||
func TestFsNewObjectDir(t *testing.T) { fstests.TestFsNewObjectDir(t) }
|
||||
func TestFsCopy(t *testing.T) { fstests.TestFsCopy(t) }
|
||||
func TestFsMove(t *testing.T) { fstests.TestFsMove(t) }
|
||||
func TestFsDirMove(t *testing.T) { fstests.TestFsDirMove(t) }
|
||||
func TestFsRmdirFull(t *testing.T) { fstests.TestFsRmdirFull(t) }
|
||||
func TestFsPrecision(t *testing.T) { fstests.TestFsPrecision(t) }
|
||||
func TestFsDirChangeNotify(t *testing.T) { fstests.TestFsDirChangeNotify(t) }
|
||||
func TestObjectString(t *testing.T) { fstests.TestObjectString(t) }
|
||||
func TestObjectFs(t *testing.T) { fstests.TestObjectFs(t) }
|
||||
func TestObjectRemote(t *testing.T) { fstests.TestObjectRemote(t) }
|
||||
@@ -54,6 +62,7 @@ func TestObjectSetModTime(t *testing.T) { fstests.TestObjectSetModTime(t) }
|
||||
func TestObjectSize(t *testing.T) { fstests.TestObjectSize(t) }
|
||||
func TestObjectOpen(t *testing.T) { fstests.TestObjectOpen(t) }
|
||||
func TestObjectOpenSeek(t *testing.T) { fstests.TestObjectOpenSeek(t) }
|
||||
func TestObjectPartialRead(t *testing.T) { fstests.TestObjectPartialRead(t) }
|
||||
func TestObjectUpdate(t *testing.T) { fstests.TestObjectUpdate(t) }
|
||||
func TestObjectStorable(t *testing.T) { fstests.TestObjectStorable(t) }
|
||||
func TestFsIsFile(t *testing.T) { fstests.TestFsIsFile(t) }
|
||||
|
||||
+41
-4
@@ -10,6 +10,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -22,6 +23,11 @@ var (
|
||||
parallel = flag.Int("parallel", runtime.NumCPU(), "Number of commands to run in parallel.")
|
||||
copyAs = flag.String("release", "", "Make copies of the releases with this name")
|
||||
gitLog = flag.String("git-log", "", "git log to include as well")
|
||||
include = flag.String("include", "^.*$", "os/arch regexp to include")
|
||||
exclude = flag.String("exclude", "^$", "os/arch regexp to exclude")
|
||||
cgo = flag.Bool("cgo", false, "Use cgo for the build")
|
||||
noClean = flag.Bool("no-clean", false, "Don't clean the build directory before running.")
|
||||
tags = flag.String("tags", "", "Space separated list of build tags")
|
||||
)
|
||||
|
||||
// GOOS/GOARCH pairs we build for
|
||||
@@ -49,6 +55,11 @@ var osarches = []string{
|
||||
"solaris/amd64",
|
||||
}
|
||||
|
||||
// Special environment flags for a given arch
|
||||
var archFlags = map[string][]string{
|
||||
"386": {"GO386=387"},
|
||||
}
|
||||
|
||||
// runEnv - run a shell command with env
|
||||
func runEnv(args, env []string) {
|
||||
if *debug {
|
||||
@@ -60,6 +71,9 @@ func runEnv(args, env []string) {
|
||||
if env != nil {
|
||||
cmd.Env = append(os.Environ(), env...)
|
||||
}
|
||||
if *debug {
|
||||
log.Printf("args = %v, env = %v\n", args, cmd.Env)
|
||||
}
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to run %v: %v", args, err)
|
||||
@@ -87,12 +101,20 @@ func compileArch(version, goos, goarch, dir string) {
|
||||
"--ldflags", "-s -X github.com/ncw/rclone/fs.Version=" + version,
|
||||
"-i",
|
||||
"-o", output,
|
||||
"-tags", *tags,
|
||||
"..",
|
||||
}
|
||||
env := []string{
|
||||
"GOOS=" + goos,
|
||||
"GOARCH=" + goarch,
|
||||
"CGO_ENABLED=0",
|
||||
}
|
||||
if !*cgo {
|
||||
env = append(env, "CGO_ENABLED=0")
|
||||
} else {
|
||||
env = append(env, "CGO_ENABLED=1")
|
||||
}
|
||||
if flags, ok := archFlags[goarch]; ok {
|
||||
env = append(env, flags...)
|
||||
}
|
||||
runEnv(args, env)
|
||||
// Now build the zip
|
||||
@@ -125,7 +147,19 @@ func compile(version string) {
|
||||
}
|
||||
}()
|
||||
}
|
||||
includeRe, err := regexp.Compile(*include)
|
||||
if err != nil {
|
||||
log.Fatalf("Bad -include regexp: %v", err)
|
||||
}
|
||||
excludeRe, err := regexp.Compile(*exclude)
|
||||
if err != nil {
|
||||
log.Fatalf("Bad -exclude regexp: %v", err)
|
||||
}
|
||||
compiled := 0
|
||||
for _, osarch := range osarches {
|
||||
if excludeRe.MatchString(osarch) || !includeRe.MatchString(osarch) {
|
||||
continue
|
||||
}
|
||||
parts := strings.Split(osarch, "/")
|
||||
if len(parts) != 2 {
|
||||
log.Fatalf("Bad osarch %q", osarch)
|
||||
@@ -139,10 +173,11 @@ func compile(version string) {
|
||||
run <- func() {
|
||||
compileArch(version, goos, goarch, dir)
|
||||
}
|
||||
compiled++
|
||||
}
|
||||
close(run)
|
||||
wg.Wait()
|
||||
log.Printf("Compiled %d arches in %v", len(osarches), time.Since(start))
|
||||
log.Printf("Compiled %d arches in %v", compiled, time.Since(start))
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -152,8 +187,10 @@ func main() {
|
||||
log.Fatalf("Syntax: %s <version>", os.Args[0])
|
||||
}
|
||||
version := args[0]
|
||||
run("rm", "-rf", "build")
|
||||
run("mkdir", "build")
|
||||
if !*noClean {
|
||||
run("rm", "-rf", "build")
|
||||
run("mkdir", "build")
|
||||
}
|
||||
err := os.Chdir("build")
|
||||
if err != nil {
|
||||
log.Fatalf("Couldn't cd into build dir: %v", err)
|
||||
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/python
|
||||
"""
|
||||
This is a tool to decrypt file names in rclone logs.
|
||||
|
||||
Pass two files in, the first should be a crypt mapping generated by
|
||||
|
||||
rclone ls --crypt-show-mapping remote:path
|
||||
|
||||
The second should be a log file that you want the paths decrypted in.
|
||||
|
||||
Note that if the crypt mappings file is large it can take some time to
|
||||
run.
|
||||
"""
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
# Crypt line
|
||||
match_crypt = re.compile(r'NOTICE: (.*?): Encrypts to "(.*?)"$')
|
||||
|
||||
def read_crypt_map(mapping_file):
|
||||
"""
|
||||
Read the crypt mapping file in, creating a dictionary of substitutions
|
||||
"""
|
||||
mapping = {}
|
||||
with open(mapping_file) as fd:
|
||||
for line in fd:
|
||||
match = match_crypt.search(line)
|
||||
if match:
|
||||
plaintext, ciphertext = match.groups()
|
||||
plaintexts = plaintext.split("/")
|
||||
ciphertexts = ciphertext.split("/")
|
||||
for plain, cipher in zip(plaintexts, ciphertexts):
|
||||
mapping[cipher] = plain
|
||||
return mapping
|
||||
|
||||
def map_log_file(crypt_map, log_file):
|
||||
"""
|
||||
Substitute the crypt_map in the log file.
|
||||
|
||||
This uses a straight forward O(N**2) algorithm. I tried using
|
||||
regexps to speed it up but it made it slower!
|
||||
"""
|
||||
with open(log_file) as fd:
|
||||
for line in fd:
|
||||
for cipher, plain in crypt_map.iteritems():
|
||||
line = line.replace(cipher, plain)
|
||||
sys.stdout.write(line)
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 3:
|
||||
print "Syntax: %s <crypt-mapping-file> <log-file>" % sys.argv[0]
|
||||
raise SystemExit(1)
|
||||
mapping_file, log_file = sys.argv[1:]
|
||||
crypt_map = read_crypt_map(mapping_file)
|
||||
map_log_file(crypt_map, log_file)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+3
-1
@@ -30,6 +30,8 @@ docs = [
|
||||
"b2.md",
|
||||
"yandex.md",
|
||||
"sftp.md",
|
||||
"ftp.md",
|
||||
"http.md",
|
||||
"crypt.md",
|
||||
"local.md",
|
||||
"changelog.md",
|
||||
@@ -81,7 +83,7 @@ def read_doc(doc):
|
||||
# Remove icons
|
||||
contents = re.sub(r'<i class="fa.*?</i>\s*', "", contents)
|
||||
# Make [...](/links/) absolute
|
||||
contents = re.sub(r'\((\/.*?\/)\)', r"(http://rclone.org\1)", contents)
|
||||
contents = re.sub(r'\((\/.*?\/)\)', r"(https://rclone.org\1)", contents)
|
||||
return contents
|
||||
|
||||
def check_docs(docpath):
|
||||
|
||||
File renamed without changes.
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Update the authors.md file with the authors from the git log
|
||||
"""
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
AUTHORS = "docs/content/authors.md"
|
||||
IGNORE = [ "nick@raig-wood.com" ]
|
||||
|
||||
def load():
|
||||
"""
|
||||
returns a set of emails already in authors.md
|
||||
"""
|
||||
with open(AUTHORS) as fd:
|
||||
authors = fd.read()
|
||||
emails = set(re.findall(r"<(.*?)>", authors))
|
||||
emails.update(IGNORE)
|
||||
return emails
|
||||
|
||||
def add_email(name, email):
|
||||
"""
|
||||
adds the email passed in to the end of authors.md
|
||||
"""
|
||||
print "Adding %s <%s>" % (name, email)
|
||||
with open(AUTHORS, "a+") as fd:
|
||||
print >>fd, " * %s <%s>" % (name, email)
|
||||
subprocess.check_call(["git", "commit", "-m", "Add %s to contributors" % name, AUTHORS])
|
||||
|
||||
def main():
|
||||
out = subprocess.check_output(["git", "log", '--reverse', '--format=%an|%ae', "master"])
|
||||
|
||||
previous = load()
|
||||
for line in out.split("\n"):
|
||||
line = line.strip()
|
||||
if line == "":
|
||||
continue
|
||||
name, email = line.split("|")
|
||||
if email in previous:
|
||||
continue
|
||||
previous.add(email)
|
||||
add_email(name, email)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
echo Setting environment variables for mingw+WinFsp compile
|
||||
set GOPATH=X:\go
|
||||
set PATH=C:\Program Files\mingw-w64\i686-7.1.0-win32-dwarf-rt_v5-rev0\mingw32\bin;%PATH%
|
||||
set CPATH=C:\Program Files\WinFsp\inc\fuse
|
||||
@@ -8,17 +8,22 @@ import (
|
||||
_ "github.com/ncw/rclone/cmd/cat"
|
||||
_ "github.com/ncw/rclone/cmd/check"
|
||||
_ "github.com/ncw/rclone/cmd/cleanup"
|
||||
_ "github.com/ncw/rclone/cmd/cmount"
|
||||
_ "github.com/ncw/rclone/cmd/config"
|
||||
_ "github.com/ncw/rclone/cmd/copy"
|
||||
_ "github.com/ncw/rclone/cmd/copyto"
|
||||
_ "github.com/ncw/rclone/cmd/cryptcheck"
|
||||
_ "github.com/ncw/rclone/cmd/dbhashsum"
|
||||
_ "github.com/ncw/rclone/cmd/dedupe"
|
||||
_ "github.com/ncw/rclone/cmd/delete"
|
||||
_ "github.com/ncw/rclone/cmd/genautocomplete"
|
||||
_ "github.com/ncw/rclone/cmd/gendocs"
|
||||
_ "github.com/ncw/rclone/cmd/info"
|
||||
_ "github.com/ncw/rclone/cmd/listremotes"
|
||||
_ "github.com/ncw/rclone/cmd/ls"
|
||||
_ "github.com/ncw/rclone/cmd/ls2"
|
||||
_ "github.com/ncw/rclone/cmd/lsd"
|
||||
_ "github.com/ncw/rclone/cmd/lsjson"
|
||||
_ "github.com/ncw/rclone/cmd/lsl"
|
||||
_ "github.com/ncw/rclone/cmd/md5sum"
|
||||
_ "github.com/ncw/rclone/cmd/memtest"
|
||||
@@ -26,6 +31,7 @@ import (
|
||||
_ "github.com/ncw/rclone/cmd/mount"
|
||||
_ "github.com/ncw/rclone/cmd/move"
|
||||
_ "github.com/ncw/rclone/cmd/moveto"
|
||||
_ "github.com/ncw/rclone/cmd/ncdu"
|
||||
_ "github.com/ncw/rclone/cmd/obscure"
|
||||
_ "github.com/ncw/rclone/cmd/purge"
|
||||
_ "github.com/ncw/rclone/cmd/rmdir"
|
||||
|
||||
+8
-30
@@ -14,7 +14,6 @@ import (
|
||||
"regexp"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@@ -40,7 +39,7 @@ var Root = &cobra.Command{
|
||||
Short: "Sync files and directories to and from local and remote object stores - " + fs.Version,
|
||||
Long: `
|
||||
Rclone is a command line program to sync files and directories to and
|
||||
from various cloud storage systems, such as:
|
||||
from various cloud storage systems and using file transfer services, such as:
|
||||
|
||||
* Google Drive
|
||||
* Amazon S3
|
||||
@@ -48,10 +47,13 @@ from various cloud storage systems, such as:
|
||||
* Dropbox
|
||||
* Google Cloud Storage
|
||||
* Amazon Drive
|
||||
* Microsoft One Drive
|
||||
* Microsoft OneDrive
|
||||
* Hubic
|
||||
* Backblaze B2
|
||||
* Yandex Disk
|
||||
* SFTP
|
||||
* FTP
|
||||
* HTTP
|
||||
* The local filesystem
|
||||
|
||||
Features
|
||||
@@ -67,7 +69,7 @@ Features
|
||||
See the home page for installation, usage, documentation, changelog
|
||||
and configuration walkthroughs.
|
||||
|
||||
* http://rclone.org/
|
||||
* https://rclone.org/
|
||||
`,
|
||||
PersistentPostRun: func(cmd *cobra.Command, args []string) {
|
||||
fs.Debugf("rclone", "Version %q finishing with parameters %q", fs.Version, os.Args)
|
||||
@@ -164,30 +166,6 @@ func NewFsSrcDst(args []string) (fs.Fs, fs.Fs) {
|
||||
return fsrc, fdst
|
||||
}
|
||||
|
||||
// RemoteSplit splits a remote into a parent and a leaf
|
||||
//
|
||||
// if it returns leaf as an empty string then remote is a directory
|
||||
//
|
||||
// if it returns parent as an empty string then that means the current directory
|
||||
//
|
||||
// The returned values have the property that parent + leaf == remote
|
||||
func RemoteSplit(remote string) (parent string, leaf string) {
|
||||
// Split remote on :
|
||||
i := strings.Index(remote, ":")
|
||||
remoteName := ""
|
||||
remotePath := remote
|
||||
if i >= 0 {
|
||||
remoteName = remote[:i+1]
|
||||
remotePath = remote[i+1:]
|
||||
} else if strings.HasSuffix(remotePath, "/") {
|
||||
// if no : and ends with / must be directory
|
||||
return remotePath, ""
|
||||
}
|
||||
// Construct new remote name without last segment
|
||||
parent, leaf = path.Split(remotePath)
|
||||
return remoteName + parent, leaf
|
||||
}
|
||||
|
||||
// NewFsSrcDstFiles creates a new src and dst fs from the arguments
|
||||
// If src is a file then srcFileName and dstFileName will be non-empty
|
||||
func NewFsSrcDstFiles(args []string) (fsrc fs.Fs, srcFileName string, fdst fs.Fs, dstFileName string) {
|
||||
@@ -195,7 +173,7 @@ func NewFsSrcDstFiles(args []string) (fsrc fs.Fs, srcFileName string, fdst fs.Fs
|
||||
// If copying a file...
|
||||
dstRemote := args[1]
|
||||
if srcFileName != "" {
|
||||
dstRemote, dstFileName = RemoteSplit(dstRemote)
|
||||
dstRemote, dstFileName = fs.RemoteSplit(dstRemote)
|
||||
if dstRemote == "" {
|
||||
dstRemote = "."
|
||||
}
|
||||
@@ -275,7 +253,7 @@ func Run(Retry bool, showStats bool, cmd *cobra.Command, f func() error) {
|
||||
log.Fatalf("Failed to %s: %v", cmd.Name(), err)
|
||||
}
|
||||
if showStats && (fs.Stats.Errored() || *statsInterval > 0) {
|
||||
fs.Infof(nil, "%s", fs.Stats)
|
||||
fs.Stats.Log()
|
||||
}
|
||||
fs.Debugf(nil, "Go routines at exit %d\n", runtime.NumGoroutine())
|
||||
if fs.Stats.Errored() {
|
||||
|
||||
@@ -0,0 +1,663 @@
|
||||
// +build cmount
|
||||
// +build cgo
|
||||
// +build linux darwin freebsd windows
|
||||
|
||||
package cmount
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/billziss-gh/cgofuse/fuse"
|
||||
"github.com/ncw/rclone/cmd/mountlib"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const fhUnset = ^uint64(0)
|
||||
|
||||
// FS represents the top level filing system
|
||||
type FS struct {
|
||||
FS *mountlib.FS
|
||||
f fs.Fs
|
||||
openDirs *openFiles
|
||||
openFilesWr *openFiles
|
||||
openFilesRd *openFiles
|
||||
ready chan (struct{})
|
||||
}
|
||||
|
||||
// NewFS makes a new FS
|
||||
func NewFS(f fs.Fs) *FS {
|
||||
fsys := &FS{
|
||||
FS: mountlib.NewFS(f),
|
||||
f: f,
|
||||
openDirs: newOpenFiles(0x01),
|
||||
openFilesWr: newOpenFiles(0x02),
|
||||
openFilesRd: newOpenFiles(0x03),
|
||||
ready: make(chan (struct{})),
|
||||
}
|
||||
return fsys
|
||||
}
|
||||
|
||||
type openFiles struct {
|
||||
mu sync.Mutex
|
||||
mark uint8
|
||||
nodes []mountlib.Noder
|
||||
}
|
||||
|
||||
func newOpenFiles(mark uint8) *openFiles {
|
||||
return &openFiles{
|
||||
mark: mark,
|
||||
}
|
||||
}
|
||||
|
||||
// Open a node returning a file handle
|
||||
func (of *openFiles) Open(node mountlib.Noder) (fh uint64) {
|
||||
of.mu.Lock()
|
||||
defer of.mu.Unlock()
|
||||
var i int
|
||||
var oldNode mountlib.Noder
|
||||
for i, oldNode = range of.nodes {
|
||||
if oldNode == nil {
|
||||
of.nodes[i] = node
|
||||
goto found
|
||||
}
|
||||
}
|
||||
of.nodes = append(of.nodes, node)
|
||||
i = len(of.nodes) - 1
|
||||
found:
|
||||
return uint64((i << 8) | int(of.mark))
|
||||
}
|
||||
|
||||
// InRange to see if this fh could be one of ours
|
||||
func (of *openFiles) InRange(fh uint64) bool {
|
||||
return uint8(fh) == of.mark
|
||||
}
|
||||
|
||||
// get the node for fh, call with the lock held
|
||||
func (of *openFiles) get(fh uint64) (i int, node mountlib.Noder, errc int) {
|
||||
receivedMark := uint8(fh)
|
||||
if receivedMark != of.mark {
|
||||
fs.Debugf(nil, "Bad file handle: bad mark 0x%X != 0x%X: 0x%X", receivedMark, of.mark, fh)
|
||||
return i, nil, -fuse.EBADF
|
||||
}
|
||||
i64 := fh >> 8
|
||||
if i64 > uint64(len(of.nodes)) {
|
||||
fs.Debugf(nil, "Bad file handle: too big: 0x%X", fh)
|
||||
return i, nil, -fuse.EBADF
|
||||
}
|
||||
i = int(i64)
|
||||
node = of.nodes[i]
|
||||
if node == nil {
|
||||
fs.Debugf(nil, "Bad file handle: nil node: 0x%X", fh)
|
||||
return i, nil, -fuse.EBADF
|
||||
}
|
||||
return i, node, 0
|
||||
}
|
||||
|
||||
// Get the node for the file handle
|
||||
func (of *openFiles) Get(fh uint64) (node mountlib.Noder, errc int) {
|
||||
of.mu.Lock()
|
||||
_, node, errc = of.get(fh)
|
||||
of.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// Close the node
|
||||
func (of *openFiles) Close(fh uint64) (errc int) {
|
||||
of.mu.Lock()
|
||||
i, _, errc := of.get(fh)
|
||||
if errc == 0 {
|
||||
of.nodes[i] = nil
|
||||
}
|
||||
of.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// lookup a Node given a path
|
||||
func (fsys *FS) lookupNode(path string) (node mountlib.Node, errc int) {
|
||||
node, err := fsys.FS.Lookup(path)
|
||||
return node, translateError(err)
|
||||
}
|
||||
|
||||
// lookup a Dir given a path
|
||||
func (fsys *FS) lookupDir(path string) (dir *mountlib.Dir, errc int) {
|
||||
node, errc := fsys.lookupNode(path)
|
||||
if errc != 0 {
|
||||
return nil, errc
|
||||
}
|
||||
dir, ok := node.(*mountlib.Dir)
|
||||
if !ok {
|
||||
return nil, -fuse.ENOTDIR
|
||||
}
|
||||
return dir, 0
|
||||
}
|
||||
|
||||
// lookup a parent Dir given a path returning the dir and the leaf
|
||||
func (fsys *FS) lookupParentDir(filePath string) (leaf string, dir *mountlib.Dir, errc int) {
|
||||
parentDir, leaf := path.Split(filePath)
|
||||
dir, errc = fsys.lookupDir(parentDir)
|
||||
return leaf, dir, errc
|
||||
}
|
||||
|
||||
// lookup a File given a path
|
||||
func (fsys *FS) lookupFile(path string) (file *mountlib.File, errc int) {
|
||||
node, errc := fsys.lookupNode(path)
|
||||
if errc != 0 {
|
||||
return nil, errc
|
||||
}
|
||||
file, ok := node.(*mountlib.File)
|
||||
if !ok {
|
||||
return nil, -fuse.EISDIR
|
||||
}
|
||||
return file, 0
|
||||
}
|
||||
|
||||
// Get the underlying openFile handle from the file handle
|
||||
func (fsys *FS) getOpenFilesFromFh(fh uint64) (of *openFiles, errc int) {
|
||||
switch {
|
||||
case fsys.openFilesRd.InRange(fh):
|
||||
return fsys.openFilesRd, 0
|
||||
case fsys.openFilesWr.InRange(fh):
|
||||
return fsys.openFilesWr, 0
|
||||
case fsys.openDirs.InRange(fh):
|
||||
return fsys.openDirs, 0
|
||||
}
|
||||
return nil, -fuse.EBADF
|
||||
}
|
||||
|
||||
// Get the underlying handle from the file handle
|
||||
func (fsys *FS) getHandleFromFh(fh uint64) (handle mountlib.Noder, errc int) {
|
||||
of, errc := fsys.getOpenFilesFromFh(fh)
|
||||
if errc != 0 {
|
||||
return nil, errc
|
||||
}
|
||||
return of.Get(fh)
|
||||
}
|
||||
|
||||
// get a node from the path or from the fh if not fhUnset
|
||||
func (fsys *FS) getNode(path string, fh uint64) (node mountlib.Node, errc int) {
|
||||
if fh == fhUnset {
|
||||
node, errc = fsys.lookupNode(path)
|
||||
} else {
|
||||
var n mountlib.Noder
|
||||
n, errc = fsys.getHandleFromFh(fh)
|
||||
if errc == 0 {
|
||||
node = n.Node()
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// stat fills up the stat block for Node
|
||||
func (fsys *FS) stat(node mountlib.Node, stat *fuse.Stat_t) (errc int) {
|
||||
var Size uint64
|
||||
var Blocks uint64
|
||||
var modTime time.Time
|
||||
var Mode os.FileMode
|
||||
switch x := node.(type) {
|
||||
case *mountlib.Dir:
|
||||
modTime = x.ModTime()
|
||||
Mode = mountlib.DirPerms | fuse.S_IFDIR
|
||||
case *mountlib.File:
|
||||
var err error
|
||||
modTime, Size, Blocks, err = x.Attr(mountlib.NoModTime)
|
||||
if err != nil {
|
||||
return translateError(err)
|
||||
}
|
||||
Mode = mountlib.FilePerms | fuse.S_IFREG
|
||||
}
|
||||
//stat.Dev = 1
|
||||
stat.Ino = node.Inode() // FIXME do we need to set the inode number?
|
||||
stat.Mode = uint32(Mode)
|
||||
stat.Nlink = 1
|
||||
stat.Uid = mountlib.UID
|
||||
stat.Gid = mountlib.GID
|
||||
//stat.Rdev
|
||||
stat.Size = int64(Size)
|
||||
t := fuse.NewTimespec(modTime)
|
||||
stat.Atim = t
|
||||
stat.Mtim = t
|
||||
stat.Ctim = t
|
||||
stat.Blksize = 512
|
||||
stat.Blocks = int64(Blocks)
|
||||
stat.Birthtim = t
|
||||
// fs.Debugf(nil, "stat = %+v", *stat)
|
||||
return 0
|
||||
}
|
||||
|
||||
// Init is called after the filesystem is ready
|
||||
func (fsys *FS) Init() {
|
||||
defer fs.Trace(fsys.f, "")("")
|
||||
close(fsys.ready)
|
||||
}
|
||||
|
||||
// Destroy is called when it is unmounted (note that depending on how
|
||||
// the file system is terminated the file system may not receive the
|
||||
// Destroy call).
|
||||
func (fsys *FS) Destroy() {
|
||||
defer fs.Trace(fsys.f, "")("")
|
||||
}
|
||||
|
||||
// Getattr reads the attributes for path
|
||||
func (fsys *FS) Getattr(path string, stat *fuse.Stat_t, fh uint64) (errc int) {
|
||||
defer fs.Trace(path, "fh=0x%X", fh)("errc=%v", &errc)
|
||||
node, errc := fsys.getNode(path, fh)
|
||||
if errc == 0 {
|
||||
errc = fsys.stat(node, stat)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Opendir opens path as a directory
|
||||
func (fsys *FS) Opendir(path string) (errc int, fh uint64) {
|
||||
defer fs.Trace(path, "")("errc=%d, fh=0x%X", &errc, &fh)
|
||||
dir, errc := fsys.lookupDir(path)
|
||||
if errc == 0 {
|
||||
fh = fsys.openDirs.Open(dir)
|
||||
} else {
|
||||
fh = fhUnset
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Readdir reads the directory at dirPath
|
||||
func (fsys *FS) Readdir(dirPath string,
|
||||
fill func(name string, stat *fuse.Stat_t, ofst int64) bool,
|
||||
ofst int64,
|
||||
fh uint64) (errc int) {
|
||||
itemsRead := -1
|
||||
defer fs.Trace(dirPath, "ofst=%d, fh=0x%X", ofst, fh)("items=%d, errc=%d", &itemsRead, &errc)
|
||||
|
||||
node, errc := fsys.openDirs.Get(fh)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
|
||||
dir, ok := node.(*mountlib.Dir)
|
||||
if !ok {
|
||||
return -fuse.ENOTDIR
|
||||
}
|
||||
|
||||
items, err := dir.ReadDirAll()
|
||||
if err != nil {
|
||||
return translateError(err)
|
||||
}
|
||||
|
||||
// Optionally, create a struct stat that describes the file as
|
||||
// for getattr (but FUSE only looks at st_ino and the
|
||||
// file-type bits of st_mode).
|
||||
//
|
||||
// FIXME If you call host.SetCapReaddirPlus() then WinFsp will
|
||||
// use the full stat information - a Useful optimization on
|
||||
// Windows.
|
||||
//
|
||||
// NB we are using the first mode for readdir: The readdir
|
||||
// implementation ignores the offset parameter, and passes
|
||||
// zero to the filler function's offset. The filler function
|
||||
// will not return '1' (unless an error happens), so the whole
|
||||
// directory is read in a single readdir operation.
|
||||
fill(".", nil, 0)
|
||||
fill("..", nil, 0)
|
||||
for _, item := range items {
|
||||
name := path.Base(item.Obj.Remote())
|
||||
fill(name, nil, 0)
|
||||
}
|
||||
itemsRead = len(items)
|
||||
return 0
|
||||
}
|
||||
|
||||
// Releasedir finished reading the directory
|
||||
func (fsys *FS) Releasedir(path string, fh uint64) (errc int) {
|
||||
defer fs.Trace(path, "fh=0x%X", fh)("errc=%d", &errc)
|
||||
return fsys.openDirs.Close(fh)
|
||||
}
|
||||
|
||||
// Statfs reads overall stats on the filessystem
|
||||
func (fsys *FS) Statfs(path string, stat *fuse.Statfs_t) (errc int) {
|
||||
defer fs.Trace(path, "")("stat=%+v, errc=%d", stat, &errc)
|
||||
const blockSize = 4096
|
||||
fsBlocks := uint64(1 << 50)
|
||||
if runtime.GOOS == "windows" {
|
||||
fsBlocks = (1 << 43) - 1
|
||||
}
|
||||
stat.Blocks = fsBlocks // Total data blocks in file system.
|
||||
stat.Bfree = fsBlocks // Free blocks in file system.
|
||||
stat.Bavail = fsBlocks // Free blocks in file system if you're not root.
|
||||
stat.Files = 1E9 // Total files in file system.
|
||||
stat.Ffree = 1E9 // Free files in file system.
|
||||
stat.Bsize = blockSize // Block size
|
||||
stat.Namemax = 255 // Maximum file name length?
|
||||
stat.Frsize = blockSize // Fragment size, smallest addressable data size in the file system.
|
||||
return 0
|
||||
}
|
||||
|
||||
// Open opens a file
|
||||
func (fsys *FS) Open(path string, flags int) (errc int, fh uint64) {
|
||||
defer fs.Trace(path, "flags=0x%X", flags)("errc=%d, fh=0x%X", &errc, &fh)
|
||||
file, errc := fsys.lookupFile(path)
|
||||
if errc != 0 {
|
||||
return errc, fhUnset
|
||||
}
|
||||
rdwrMode := flags & fuse.O_ACCMODE
|
||||
var err error
|
||||
var handle mountlib.Noder
|
||||
switch {
|
||||
case rdwrMode == fuse.O_RDONLY:
|
||||
handle, err = file.OpenRead()
|
||||
if err != nil {
|
||||
return translateError(err), fhUnset
|
||||
}
|
||||
return 0, fsys.openFilesRd.Open(handle)
|
||||
case rdwrMode == fuse.O_WRONLY || (rdwrMode == fuse.O_RDWR && (flags&fuse.O_TRUNC) != 0):
|
||||
handle, err = file.OpenWrite()
|
||||
if err != nil {
|
||||
return translateError(err), fhUnset
|
||||
}
|
||||
return 0, fsys.openFilesWr.Open(handle)
|
||||
case rdwrMode == fuse.O_RDWR:
|
||||
fs.Errorf(path, "Can't open for Read and Write")
|
||||
return -fuse.EPERM, fhUnset
|
||||
}
|
||||
fs.Errorf(path, "Can't figure out how to open with flags: 0x%X", flags)
|
||||
return -fuse.EPERM, fhUnset
|
||||
}
|
||||
|
||||
// Create creates and opens a file.
|
||||
func (fsys *FS) Create(filePath string, flags int, mode uint32) (errc int, fh uint64) {
|
||||
defer fs.Trace(filePath, "flags=0x%X, mode=0%o", flags, mode)("errc=%d, fh=0x%X", &errc, &fh)
|
||||
leaf, parentDir, errc := fsys.lookupParentDir(filePath)
|
||||
if errc != 0 {
|
||||
return errc, fhUnset
|
||||
}
|
||||
_, handle, err := parentDir.Create(leaf)
|
||||
if err != nil {
|
||||
return translateError(err), fhUnset
|
||||
}
|
||||
return 0, fsys.openFilesWr.Open(handle)
|
||||
}
|
||||
|
||||
// Truncate truncates a file to size
|
||||
func (fsys *FS) Truncate(path string, size int64, fh uint64) (errc int) {
|
||||
defer fs.Trace(path, "size=%d, fh=0x%X", size, fh)("errc=%d", &errc)
|
||||
node, errc := fsys.getNode(path, fh)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
file, ok := node.(*mountlib.File)
|
||||
if !ok {
|
||||
return -fuse.EIO
|
||||
}
|
||||
// Read the size so far
|
||||
_, currentSize, _, err := file.Attr(true)
|
||||
if err != nil {
|
||||
return translateError(err)
|
||||
}
|
||||
fs.Debugf(path, "truncate to %d, currentSize %d", size, currentSize)
|
||||
if int64(currentSize) != size {
|
||||
fs.Errorf(path, "Can't truncate files")
|
||||
return -fuse.EPERM
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (fsys *FS) Read(path string, buff []byte, ofst int64, fh uint64) (n int) {
|
||||
defer fs.Trace(path, "ofst=%d, fh=0x%X", ofst, fh)("n=%d", &n)
|
||||
// FIXME detect seek
|
||||
handle, errc := fsys.openFilesRd.Get(fh)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
rfh, ok := handle.(*mountlib.ReadFileHandle)
|
||||
if !ok {
|
||||
// Can only read from read file handle
|
||||
return -fuse.EIO
|
||||
}
|
||||
data, err := rfh.Read(int64(len(buff)), ofst)
|
||||
if err != nil {
|
||||
return translateError(err)
|
||||
}
|
||||
n = copy(buff, data)
|
||||
return n
|
||||
}
|
||||
|
||||
func (fsys *FS) Write(path string, buff []byte, ofst int64, fh uint64) (n int) {
|
||||
defer fs.Trace(path, "ofst=%d, fh=0x%X", ofst, fh)("n=%d", &n)
|
||||
// FIXME detect seek
|
||||
handle, errc := fsys.openFilesWr.Get(fh)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
wfh, ok := handle.(*mountlib.WriteFileHandle)
|
||||
if !ok {
|
||||
// Can only write to write file handle
|
||||
return -fuse.EIO
|
||||
}
|
||||
// FIXME made Write return int and Read take int since must fit in RAM
|
||||
n64, err := wfh.Write(buff, ofst)
|
||||
if err != nil {
|
||||
return translateError(err)
|
||||
}
|
||||
return int(n64)
|
||||
}
|
||||
|
||||
// Flush flushes an open file descriptor or path
|
||||
func (fsys *FS) Flush(path string, fh uint64) (errc int) {
|
||||
defer fs.Trace(path, "fh=0x%X", fh)("errc=%d", &errc)
|
||||
handle, errc := fsys.getHandleFromFh(fh)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
var err error
|
||||
switch x := handle.(type) {
|
||||
case *mountlib.ReadFileHandle:
|
||||
err = x.Flush()
|
||||
case *mountlib.WriteFileHandle:
|
||||
err = x.Flush()
|
||||
default:
|
||||
return -fuse.EIO
|
||||
}
|
||||
return translateError(err)
|
||||
}
|
||||
|
||||
// Release closes the file if still open
|
||||
func (fsys *FS) Release(path string, fh uint64) (errc int) {
|
||||
defer fs.Trace(path, "fh=0x%X", fh)("errc=%d", &errc)
|
||||
of, errc := fsys.getOpenFilesFromFh(fh)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
handle, errc := of.Get(fh)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
_ = of.Close(fh)
|
||||
var err error
|
||||
switch x := handle.(type) {
|
||||
case *mountlib.ReadFileHandle:
|
||||
err = x.Release()
|
||||
case *mountlib.WriteFileHandle:
|
||||
err = x.Release()
|
||||
default:
|
||||
return -fuse.EIO
|
||||
}
|
||||
return translateError(err)
|
||||
}
|
||||
|
||||
// Unlink removes a file.
|
||||
func (fsys *FS) Unlink(filePath string) (errc int) {
|
||||
defer fs.Trace(filePath, "")("errc=%d", &errc)
|
||||
leaf, parentDir, errc := fsys.lookupParentDir(filePath)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
return translateError(parentDir.Remove(leaf))
|
||||
}
|
||||
|
||||
// Mkdir creates a directory.
|
||||
func (fsys *FS) Mkdir(dirPath string, mode uint32) (errc int) {
|
||||
defer fs.Trace(dirPath, "mode=0%o", mode)("errc=%d", &errc)
|
||||
leaf, parentDir, errc := fsys.lookupParentDir(dirPath)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
_, err := parentDir.Mkdir(leaf)
|
||||
return translateError(err)
|
||||
}
|
||||
|
||||
// Rmdir removes a directory
|
||||
func (fsys *FS) Rmdir(dirPath string) (errc int) {
|
||||
defer fs.Trace(dirPath, "")("errc=%d", &errc)
|
||||
leaf, parentDir, errc := fsys.lookupParentDir(dirPath)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
return translateError(parentDir.Remove(leaf))
|
||||
}
|
||||
|
||||
// Rename renames a file.
|
||||
func (fsys *FS) Rename(oldPath string, newPath string) (errc int) {
|
||||
defer fs.Trace(oldPath, "newPath=%q", newPath)("errc=%d", &errc)
|
||||
oldLeaf, oldParentDir, errc := fsys.lookupParentDir(oldPath)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
newLeaf, newParentDir, errc := fsys.lookupParentDir(newPath)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
return translateError(oldParentDir.Rename(oldLeaf, newLeaf, newParentDir))
|
||||
}
|
||||
|
||||
// Utimens changes the access and modification times of a file.
|
||||
func (fsys *FS) Utimens(path string, tmsp []fuse.Timespec) (errc int) {
|
||||
defer fs.Trace(path, "tmsp=%+v", tmsp)("errc=%d", &errc)
|
||||
node, errc := fsys.lookupNode(path)
|
||||
if errc != 0 {
|
||||
return errc
|
||||
}
|
||||
var t time.Time
|
||||
if tmsp == nil || len(tmsp) < 2 {
|
||||
t = time.Now()
|
||||
} else {
|
||||
t = tmsp[1].Time()
|
||||
}
|
||||
var err error
|
||||
switch x := node.(type) {
|
||||
case *mountlib.Dir:
|
||||
err = x.SetModTime(t)
|
||||
case *mountlib.File:
|
||||
err = x.SetModTime(t)
|
||||
}
|
||||
return translateError(err)
|
||||
}
|
||||
|
||||
// Mknod creates a file node.
|
||||
func (fsys *FS) Mknod(path string, mode uint32, dev uint64) (errc int) {
|
||||
defer fs.Trace(path, "mode=0x%X, dev=0x%X", mode, dev)("errc=%d", &errc)
|
||||
return -fuse.ENOSYS
|
||||
}
|
||||
|
||||
// Fsync synchronizes file contents.
|
||||
func (fsys *FS) Fsync(path string, datasync bool, fh uint64) (errc int) {
|
||||
defer fs.Trace(path, "datasync=%v, fh=0x%X", datasync, fh)("errc=%d", &errc)
|
||||
// This is a no-op for rclone
|
||||
return 0
|
||||
}
|
||||
|
||||
// Link creates a hard link to a file.
|
||||
func (fsys *FS) Link(oldpath string, newpath string) (errc int) {
|
||||
defer fs.Trace(oldpath, "newpath=%q", newpath)("errc=%d", &errc)
|
||||
return -fuse.ENOSYS
|
||||
}
|
||||
|
||||
// Symlink creates a symbolic link.
|
||||
func (fsys *FS) Symlink(target string, newpath string) (errc int) {
|
||||
defer fs.Trace(target, "newpath=%q", newpath)("errc=%d", &errc)
|
||||
return -fuse.ENOSYS
|
||||
}
|
||||
|
||||
// Readlink reads the target of a symbolic link.
|
||||
func (fsys *FS) Readlink(path string) (errc int, linkPath string) {
|
||||
defer fs.Trace(path, "")("linkPath=%q, errc=%d", &linkPath, &errc)
|
||||
return -fuse.ENOSYS, ""
|
||||
}
|
||||
|
||||
// Chmod changes the permission bits of a file.
|
||||
func (fsys *FS) Chmod(path string, mode uint32) (errc int) {
|
||||
defer fs.Trace(path, "mode=0%o", mode)("errc=%d", &errc)
|
||||
// This is a no-op for rclone
|
||||
return 0
|
||||
}
|
||||
|
||||
// Chown changes the owner and group of a file.
|
||||
func (fsys *FS) Chown(path string, uid uint32, gid uint32) (errc int) {
|
||||
defer fs.Trace(path, "uid=%d, gid=%d", uid, gid)("errc=%d", &errc)
|
||||
// This is a no-op for rclone
|
||||
return 0
|
||||
}
|
||||
|
||||
// Access checks file access permissions.
|
||||
func (fsys *FS) Access(path string, mask uint32) (errc int) {
|
||||
defer fs.Trace(path, "mask=0%o", mask)("errc=%d", &errc)
|
||||
// This is a no-op for rclone
|
||||
return 0
|
||||
}
|
||||
|
||||
// Fsyncdir synchronizes directory contents.
|
||||
func (fsys *FS) Fsyncdir(path string, datasync bool, fh uint64) (errc int) {
|
||||
defer fs.Trace(path, "datasync=%v, fh=0x%X", datasync, fh)("errc=%d", &errc)
|
||||
// This is a no-op for rclone
|
||||
return 0
|
||||
}
|
||||
|
||||
// Setxattr sets extended attributes.
|
||||
func (fsys *FS) Setxattr(path string, name string, value []byte, flags int) (errc int) {
|
||||
return -fuse.ENOSYS
|
||||
}
|
||||
|
||||
// Getxattr gets extended attributes.
|
||||
func (fsys *FS) Getxattr(path string, name string) (errc int, value []byte) {
|
||||
return -fuse.ENOSYS, nil
|
||||
}
|
||||
|
||||
// Removexattr removes extended attributes.
|
||||
func (fsys *FS) Removexattr(path string, name string) (errc int) {
|
||||
return -fuse.ENOSYS
|
||||
}
|
||||
|
||||
// Listxattr lists extended attributes.
|
||||
func (fsys *FS) Listxattr(path string, fill func(name string) bool) (errc int) {
|
||||
return -fuse.ENOSYS
|
||||
}
|
||||
|
||||
// Translate errors from mountlib
|
||||
func translateError(err error) (errc int) {
|
||||
if err == nil {
|
||||
return 0
|
||||
}
|
||||
cause := errors.Cause(err)
|
||||
if mErr, ok := cause.(mountlib.Error); ok {
|
||||
switch mErr {
|
||||
case mountlib.OK:
|
||||
return 0
|
||||
case mountlib.ENOENT:
|
||||
return -fuse.ENOENT
|
||||
case mountlib.ENOTEMPTY:
|
||||
return -fuse.ENOTEMPTY
|
||||
case mountlib.EEXIST:
|
||||
return -fuse.EEXIST
|
||||
case mountlib.ESPIPE:
|
||||
return -fuse.ESPIPE
|
||||
case mountlib.EBADF:
|
||||
return -fuse.EBADF
|
||||
case mountlib.EROFS:
|
||||
return -fuse.EROFS
|
||||
}
|
||||
}
|
||||
fs.Errorf(nil, "IO error: %v", err)
|
||||
return -fuse.EIO
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
// Package cmount implents a FUSE mounting system for rclone remotes.
|
||||
//
|
||||
// This uses the cgo based cgofuse library
|
||||
|
||||
// +build cmount
|
||||
// +build cgo
|
||||
// +build linux darwin freebsd windows
|
||||
|
||||
package cmount
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/billziss-gh/cgofuse/fuse"
|
||||
"github.com/ncw/rclone/cmd/mountlib"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func init() {
|
||||
name := "cmount"
|
||||
if runtime.GOOS == "windows" {
|
||||
name = "mount"
|
||||
}
|
||||
mountlib.NewMountCommand(name, Mount)
|
||||
}
|
||||
|
||||
// mountOptions configures the options from the command line flags
|
||||
func mountOptions(device string, mountpoint string) (options []string) {
|
||||
// Options
|
||||
options = []string{
|
||||
"-o", "fsname=" + device,
|
||||
"-o", "subtype=rclone",
|
||||
"-o", fmt.Sprintf("max_readahead=%d", mountlib.MaxReadAhead),
|
||||
}
|
||||
if mountlib.DebugFUSE {
|
||||
options = append(options, "-o", "debug")
|
||||
}
|
||||
|
||||
// OSX options
|
||||
if runtime.GOOS == "darwin" {
|
||||
options = append(options, "-o", "volname="+device)
|
||||
options = append(options, "-o", "noappledouble")
|
||||
options = append(options, "-o", "noapplexattr")
|
||||
}
|
||||
|
||||
// Windows options
|
||||
if runtime.GOOS == "windows" {
|
||||
// These cause WinFsp to mean the current user
|
||||
options = append(options, "-o", "uid=-1")
|
||||
options = append(options, "-o", "gid=-1")
|
||||
options = append(options, "--FileSystemName=rclone")
|
||||
}
|
||||
|
||||
if mountlib.AllowNonEmpty {
|
||||
options = append(options, "-o", "nonempty")
|
||||
}
|
||||
if mountlib.AllowOther {
|
||||
options = append(options, "-o", "allow_other")
|
||||
}
|
||||
if mountlib.AllowRoot {
|
||||
options = append(options, "-o", "allow_root")
|
||||
}
|
||||
if mountlib.DefaultPermissions {
|
||||
options = append(options, "-o", "default_permissions")
|
||||
}
|
||||
if mountlib.ReadOnly {
|
||||
options = append(options, "-o", "ro")
|
||||
}
|
||||
if mountlib.WritebackCache {
|
||||
// FIXME? options = append(options, "-o", WritebackCache())
|
||||
}
|
||||
for _, option := range *mountlib.ExtraOptions {
|
||||
options = append(options, "-o", option)
|
||||
}
|
||||
for _, option := range *mountlib.ExtraFlags {
|
||||
options = append(options, option)
|
||||
}
|
||||
return options
|
||||
}
|
||||
|
||||
// mount the file system
|
||||
//
|
||||
// The mount point will be ready when this returns.
|
||||
//
|
||||
// returns an error, and an error channel for the serve process to
|
||||
// report an error when fusermount is called.
|
||||
func mount(f fs.Fs, mountpoint string) (*mountlib.FS, <-chan error, func() error, error) {
|
||||
fs.Debugf(f, "Mounting on %q", mountpoint)
|
||||
|
||||
// Check the mountpoint - in Windows the mountpoint musn't exist before the mount
|
||||
if runtime.GOOS != "windows" {
|
||||
fi, err := os.Stat(mountpoint)
|
||||
if err != nil {
|
||||
return nil, nil, nil, errors.Wrap(err, "mountpoint")
|
||||
}
|
||||
if !fi.IsDir() {
|
||||
return nil, nil, nil, errors.New("mountpoint is not a directory")
|
||||
}
|
||||
}
|
||||
|
||||
// Create underlying FS
|
||||
fsys := NewFS(f)
|
||||
host := fuse.NewFileSystemHost(fsys)
|
||||
|
||||
// Create options
|
||||
options := mountOptions(f.Name()+":"+f.Root(), mountpoint)
|
||||
fs.Debugf(f, "Mounting with options: %q", options)
|
||||
|
||||
// Serve the mount point in the background returning error to errChan
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
var err error
|
||||
ok := host.Mount(mountpoint, options)
|
||||
if !ok {
|
||||
err = errors.New("mount failed")
|
||||
fs.Errorf(f, "Mount failed")
|
||||
}
|
||||
errChan <- err
|
||||
}()
|
||||
|
||||
// unmount
|
||||
unmount := func() error {
|
||||
fs.Debugf(nil, "Calling host.Unmount")
|
||||
if host.Unmount() {
|
||||
fs.Debugf(nil, "host.Unmount succeeded")
|
||||
return nil
|
||||
}
|
||||
fs.Debugf(nil, "host.Unmount failed")
|
||||
return errors.New("host unmount failed")
|
||||
}
|
||||
|
||||
// Wait for the filesystem to become ready, checking the file
|
||||
// system didn't blow up before starting
|
||||
select {
|
||||
case err := <-errChan:
|
||||
err = errors.Wrap(err, "mount stopped before calling Init")
|
||||
return nil, nil, nil, err
|
||||
case <-fsys.ready:
|
||||
}
|
||||
|
||||
// Wait for the mount point to be available on Windows
|
||||
// On Windows the Init signal comes slightly before the mount is ready
|
||||
if runtime.GOOS == "windows" {
|
||||
const totalWait = 10 * time.Second
|
||||
const individualWait = 10 * time.Millisecond
|
||||
for i := 0; i < int(totalWait/individualWait); i++ {
|
||||
_, err := os.Stat(mountpoint)
|
||||
if err == nil {
|
||||
goto found
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
fs.Errorf(nil, "mountpoint %q didn't became available after %v - continuing anyway", mountpoint, totalWait)
|
||||
found:
|
||||
}
|
||||
|
||||
return fsys.FS, errChan, unmount, nil
|
||||
}
|
||||
|
||||
// Mount mounts the remote at mountpoint.
|
||||
//
|
||||
// If noModTime is set then it
|
||||
func Mount(f fs.Fs, mountpoint string) error {
|
||||
// Mount it
|
||||
FS, errChan, _, err := mount(f, mountpoint)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to mount FUSE fs")
|
||||
}
|
||||
|
||||
// Note cgofuse unmounts the fs on SIGINT etc
|
||||
|
||||
sigHup := make(chan os.Signal, 1)
|
||||
signal.Notify(sigHup, syscall.SIGHUP)
|
||||
|
||||
waitloop:
|
||||
for {
|
||||
select {
|
||||
// umount triggered outside the app
|
||||
case err = <-errChan:
|
||||
break waitloop
|
||||
// user sent SIGHUP to clear the cache
|
||||
case <-sigHup:
|
||||
root, err := FS.Root()
|
||||
if err != nil {
|
||||
fs.Errorf(f, "Error reading root: %v", err)
|
||||
} else {
|
||||
root.ForgetAll()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to umount FUSE fs")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// +build cmount
|
||||
// +build cgo
|
||||
// +build linux darwin freebsd windows
|
||||
|
||||
package cmount
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/ncw/rclone/cmd/mountlib/mounttest"
|
||||
)
|
||||
|
||||
func notWin(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("not running on windows")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) { mounttest.TestMain(m, mount) }
|
||||
func TestDirLs(t *testing.T) { mounttest.TestDirLs(t) }
|
||||
func TestDirCreateAndRemoveDir(t *testing.T) { notWin(t); mounttest.TestDirCreateAndRemoveDir(t) }
|
||||
func TestDirCreateAndRemoveFile(t *testing.T) { notWin(t); mounttest.TestDirCreateAndRemoveFile(t) }
|
||||
func TestDirRenameFile(t *testing.T) { notWin(t); mounttest.TestDirRenameFile(t) }
|
||||
func TestDirRenameEmptyDir(t *testing.T) { notWin(t); mounttest.TestDirRenameEmptyDir(t) }
|
||||
func TestDirRenameFullDir(t *testing.T) { notWin(t); mounttest.TestDirRenameFullDir(t) }
|
||||
func TestDirModTime(t *testing.T) { notWin(t); mounttest.TestDirModTime(t) }
|
||||
func TestDirCacheFlush(t *testing.T) { notWin(t); mounttest.TestDirCacheFlush(t) }
|
||||
func TestDirCacheFlushOnDirRename(t *testing.T) { notWin(t); mounttest.TestDirCacheFlushOnDirRename(t) }
|
||||
func TestFileModTime(t *testing.T) { notWin(t); mounttest.TestFileModTime(t) }
|
||||
func TestFileModTimeWithOpenWriters(t *testing.T) {} // FIXME mounttest.TestFileModTimeWithOpenWriters(t)
|
||||
func TestMount(t *testing.T) { notWin(t); mounttest.TestMount(t) }
|
||||
func TestRoot(t *testing.T) { notWin(t); mounttest.TestRoot(t) }
|
||||
func TestReadByByte(t *testing.T) { notWin(t); mounttest.TestReadByByte(t) }
|
||||
func TestReadChecksum(t *testing.T) { notWin(t); mounttest.TestReadChecksum(t) }
|
||||
func TestReadFileDoubleClose(t *testing.T) { notWin(t); mounttest.TestReadFileDoubleClose(t) }
|
||||
func TestReadSeek(t *testing.T) { notWin(t); mounttest.TestReadSeek(t) }
|
||||
func TestWriteFileNoWrite(t *testing.T) { notWin(t); mounttest.TestWriteFileNoWrite(t) }
|
||||
func TestWriteFileWrite(t *testing.T) { notWin(t); mounttest.TestWriteFileWrite(t) }
|
||||
func TestWriteFileOverwrite(t *testing.T) { notWin(t); mounttest.TestWriteFileOverwrite(t) }
|
||||
func TestWriteFileDoubleClose(t *testing.T) { notWin(t); mounttest.TestWriteFileDoubleClose(t) }
|
||||
func TestWriteFileFsync(t *testing.T) { notWin(t); mounttest.TestWriteFileFsync(t) }
|
||||
@@ -0,0 +1,6 @@
|
||||
// Build for cmount for unsupported platforms to stop go complaining
|
||||
// about "no buildable Go source files "
|
||||
|
||||
// +build !linux,!darwin,!freebsd,!windows !cgo !cmount
|
||||
|
||||
package cmount
|
||||
@@ -14,7 +14,7 @@ func init() {
|
||||
|
||||
var commandDefintion = &cobra.Command{
|
||||
Use: "cryptcheck remote:path cryptedremote:path",
|
||||
Short: `Cryptcheck checks the integritity of a crypted remote.`,
|
||||
Short: `Cryptcheck checks the integrity of a crypted remote.`,
|
||||
Long: `
|
||||
rclone cryptcheck checks a remote against a crypted remote. This is
|
||||
the equivalent of running rclone check, but able to check the
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package dbhashsum
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/ncw/rclone/cmd"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd.Root.AddCommand(commandDefintion)
|
||||
}
|
||||
|
||||
var commandDefintion = &cobra.Command{
|
||||
Use: "dbhashsum remote:path",
|
||||
Short: `Produces a Dropbbox hash file for all the objects in the path.`,
|
||||
Long: `
|
||||
Produces a Dropbox hash file for all the objects in the path. The
|
||||
hashes are calculated according to [Dropbox content hash
|
||||
rules](https://www.dropbox.com/developers/reference/content-hash).
|
||||
The output is in the same format as md5sum and sha1sum.
|
||||
`,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(1, 1, command, args)
|
||||
fsrc := cmd.NewFsSrc(args)
|
||||
cmd.Run(false, false, command, func() error {
|
||||
return fs.DropboxHashSum(fsrc, os.Stdout)
|
||||
})
|
||||
},
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
exec rclone --check-normalization=true --check-control=true --check-length=true info \
|
||||
/tmp/testInfo \
|
||||
TestAmazonCloudDrive:testInfo \
|
||||
TestB2:testInfo \
|
||||
TestCryptDrive:testInfo \
|
||||
TestCryptSwift:testInfo \
|
||||
TestDrive:testInfo \
|
||||
TestDropbox:testInfo \
|
||||
TestGoogleCloudStorage:rclone-testinfo \
|
||||
TestOneDrive:testInfo \
|
||||
TestS3:rclone-testinfo \
|
||||
TestSftp:testInfo \
|
||||
TestSwift:testInfo \
|
||||
TestYandex:testInfo \
|
||||
TestFTP:testInfo
|
||||
|
||||
# TestHubic:testInfo \
|
||||
@@ -0,0 +1,214 @@
|
||||
package info
|
||||
|
||||
// FIXME once translations are implemented will need a no-escape
|
||||
// option for Put so we can make these tests work agaig
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ncw/rclone/cmd"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/ncw/rclone/fstest"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
checkNormalization bool
|
||||
checkControl bool
|
||||
checkLength bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd.Root.AddCommand(commandDefintion)
|
||||
commandDefintion.Flags().BoolVarP(&checkNormalization, "check-normalization", "", true, "Check UTF-8 Normalization.")
|
||||
commandDefintion.Flags().BoolVarP(&checkControl, "check-control", "", true, "Check control characters.")
|
||||
commandDefintion.Flags().BoolVarP(&checkLength, "check-length", "", true, "Check max filename length.")
|
||||
}
|
||||
|
||||
var commandDefintion = &cobra.Command{
|
||||
Use: "info [remote:path]+",
|
||||
Short: `Discovers file name limitations for paths.`,
|
||||
Long: `rclone info discovers what filenames are possible to write to the
|
||||
paths passed in and how long they can be. It can take some time. It
|
||||
will write test files into the remote:path passed in. It outputs a bit
|
||||
of go code for each one.
|
||||
`,
|
||||
Hidden: true,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(1, 1E6, command, args)
|
||||
for i := range args {
|
||||
f := cmd.NewFsDst(args[i : i+1])
|
||||
cmd.Run(false, false, command, func() error {
|
||||
return readInfo(f)
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
type results struct {
|
||||
f fs.Fs
|
||||
mu sync.Mutex
|
||||
charNeedsEscaping map[rune]bool
|
||||
maxFileLength int
|
||||
canWriteUnnormalized bool
|
||||
canReadUnnormalized bool
|
||||
canReadRenormalized bool
|
||||
}
|
||||
|
||||
func newResults(f fs.Fs) *results {
|
||||
return &results{
|
||||
f: f,
|
||||
charNeedsEscaping: make(map[rune]bool),
|
||||
}
|
||||
}
|
||||
|
||||
// Print the results to stdout
|
||||
func (r *results) Print() {
|
||||
fmt.Printf("// %s\n", r.f.Name())
|
||||
if checkControl {
|
||||
escape := []string{}
|
||||
for c, needsEscape := range r.charNeedsEscaping {
|
||||
if needsEscape {
|
||||
escape = append(escape, fmt.Sprintf("0x%02X", c))
|
||||
}
|
||||
}
|
||||
sort.Strings(escape)
|
||||
fmt.Printf("charNeedsEscaping = []byte{\n")
|
||||
fmt.Printf("\t%s\n", strings.Join(escape, ", "))
|
||||
fmt.Printf("}\n")
|
||||
}
|
||||
if checkLength {
|
||||
fmt.Printf("maxFileLength = %d\n", r.maxFileLength)
|
||||
}
|
||||
if checkNormalization {
|
||||
fmt.Printf("canWriteUnnormalized = %v\n", r.canWriteUnnormalized)
|
||||
fmt.Printf("canReadUnnormalized = %v\n", r.canReadUnnormalized)
|
||||
fmt.Printf("canReadRenormalized = %v\n", r.canReadRenormalized)
|
||||
}
|
||||
}
|
||||
|
||||
// writeFile writes a file with some random contents
|
||||
func (r *results) writeFile(path string) (fs.Object, error) {
|
||||
contents := fstest.RandomString(50)
|
||||
src := fs.NewStaticObjectInfo(path, time.Now(), int64(len(contents)), true, nil, r.f)
|
||||
return r.f.Put(bytes.NewBufferString(contents), src)
|
||||
}
|
||||
|
||||
// check whether normalization is enforced and check whether it is
|
||||
// done on the files anyway
|
||||
func (r *results) checkUTF8Normalization() {
|
||||
unnormalized := "Héroique"
|
||||
normalized := "Héroique"
|
||||
_, err := r.writeFile(unnormalized)
|
||||
if err != nil {
|
||||
r.canWriteUnnormalized = false
|
||||
return
|
||||
}
|
||||
r.canWriteUnnormalized = true
|
||||
_, err = r.f.NewObject(unnormalized)
|
||||
if err == nil {
|
||||
r.canReadUnnormalized = true
|
||||
}
|
||||
_, err = r.f.NewObject(normalized)
|
||||
if err == nil {
|
||||
r.canReadRenormalized = true
|
||||
}
|
||||
}
|
||||
|
||||
// check we can write file with the rune passed in
|
||||
func (r *results) checkChar(c rune) {
|
||||
fs.Infof(r.f, "Writing file 0x%02X", c)
|
||||
path := fmt.Sprintf("0x%02X-%c-", c, c)
|
||||
_, err := r.writeFile(path)
|
||||
escape := false
|
||||
if err != nil {
|
||||
fs.Infof(r.f, "Couldn't write file 0x%02X", c)
|
||||
} else {
|
||||
fs.Infof(r.f, "OK writing file 0x%02X", c)
|
||||
}
|
||||
r.mu.Lock()
|
||||
r.charNeedsEscaping[c] = escape
|
||||
r.mu.Unlock()
|
||||
}
|
||||
|
||||
// check we can write a file with the control chars
|
||||
func (r *results) checkControls() {
|
||||
fs.Infof(r.f, "Trying to create control character file names")
|
||||
// Concurrency control
|
||||
tokens := make(chan struct{}, fs.Config.Checkers)
|
||||
for i := 0; i < fs.Config.Checkers; i++ {
|
||||
tokens <- struct{}{}
|
||||
}
|
||||
var wg sync.WaitGroup
|
||||
for i := rune(0); i < 128; i++ {
|
||||
if i == 0 || i == '/' {
|
||||
// We're not even going to check NULL or /
|
||||
r.charNeedsEscaping[i] = true
|
||||
continue
|
||||
}
|
||||
wg.Add(1)
|
||||
c := i
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
token := <-tokens
|
||||
r.checkChar(c)
|
||||
tokens <- token
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
fs.Infof(r.f, "Done trying to create control character file names")
|
||||
}
|
||||
|
||||
// find the max file name size we can use
|
||||
func (r *results) findMaxLength() {
|
||||
const maxLen = 16 * 1024
|
||||
name := make([]byte, maxLen)
|
||||
for i := range name {
|
||||
name[i] = 'a'
|
||||
}
|
||||
// Find the first size of filename we can't write
|
||||
i := sort.Search(len(name), func(i int) (fail bool) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
fs.Infof(r.f, "Couldn't write file with name length %d: %v", i, err)
|
||||
fail = true
|
||||
}
|
||||
}()
|
||||
|
||||
path := string(name[:i])
|
||||
_, err := r.writeFile(path)
|
||||
if err != nil {
|
||||
fs.Infof(r.f, "Couldn't write file with name length %d: %v", i, err)
|
||||
return true
|
||||
}
|
||||
fs.Infof(r.f, "Wrote file with name length %d", i)
|
||||
return false
|
||||
})
|
||||
r.maxFileLength = i - 1
|
||||
fs.Infof(r.f, "Max file length is %d", r.maxFileLength)
|
||||
}
|
||||
|
||||
func readInfo(f fs.Fs) error {
|
||||
err := f.Mkdir("")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "couldn't mkdir")
|
||||
}
|
||||
r := newResults(f)
|
||||
if checkControl {
|
||||
r.checkControls()
|
||||
}
|
||||
if checkLength {
|
||||
r.findMaxLength()
|
||||
}
|
||||
if checkNormalization {
|
||||
r.checkUTF8Normalization()
|
||||
}
|
||||
r.Print()
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package ls2
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ncw/rclone/cmd"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
recurse bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd.Root.AddCommand(commandDefintion)
|
||||
commandDefintion.Flags().BoolVarP(&recurse, "recursive", "R", false, "Recurse into the listing.")
|
||||
}
|
||||
|
||||
var commandDefintion = &cobra.Command{
|
||||
Use: "ls2 remote:path",
|
||||
Short: `List directories and objects in the path.`,
|
||||
Hidden: true,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(1, 1, command, args)
|
||||
fsrc := cmd.NewFsSrc(args)
|
||||
cmd.Run(false, false, command, func() error {
|
||||
return fs.Walk(fsrc, "", false, fs.ConfigMaxDepth(recurse), func(path string, entries fs.DirEntries, err error) error {
|
||||
if err != nil {
|
||||
fs.Stats.Error()
|
||||
fs.Errorf(path, "error listing: %v", err)
|
||||
return nil
|
||||
}
|
||||
for _, entry := range entries {
|
||||
_, isDir := entry.(fs.Directory)
|
||||
if isDir {
|
||||
fmt.Println(entry.Remote() + "/")
|
||||
} else {
|
||||
fmt.Println(entry.Remote())
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package lsjson
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/ncw/rclone/cmd"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
recurse bool
|
||||
showHash bool
|
||||
noModTime bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd.Root.AddCommand(commandDefintion)
|
||||
commandDefintion.Flags().BoolVarP(&recurse, "recursive", "R", false, "Recurse into the listing.")
|
||||
commandDefintion.Flags().BoolVarP(&showHash, "hash", "", false, "Include hashes in the output (may take longer).")
|
||||
commandDefintion.Flags().BoolVarP(&noModTime, "no-modtime", "", false, "Don't read the modification time (can speed things up).")
|
||||
}
|
||||
|
||||
// lsJSON in the struct which gets marshalled for each line
|
||||
type lsJSON struct {
|
||||
Path string
|
||||
Name string
|
||||
Size int64
|
||||
ModTime Timestamp //`json:",omitempty"`
|
||||
IsDir bool
|
||||
Hashes map[string]string `json:",omitempty"`
|
||||
}
|
||||
|
||||
// Timestamp a time in RFC3339 format with Nanosecond precision secongs
|
||||
type Timestamp time.Time
|
||||
|
||||
// MarshalJSON turns a Timestamp into JSON
|
||||
func (t Timestamp) MarshalJSON() (out []byte, err error) {
|
||||
tt := time.Time(t)
|
||||
if tt.IsZero() {
|
||||
return []byte(`""`), nil
|
||||
}
|
||||
return []byte(`"` + tt.Format(time.RFC3339Nano) + `"`), nil
|
||||
}
|
||||
|
||||
var commandDefintion = &cobra.Command{
|
||||
Use: "lsjson remote:path",
|
||||
Short: `List directories and objects in the path in JSON format.`,
|
||||
Long: `List directories and objects in the path in JSON format.
|
||||
|
||||
The output is an array of Items, where each Item looks like this
|
||||
|
||||
{
|
||||
"Hashes" : {
|
||||
"SHA-1" : "f572d396fae9206628714fb2ce00f72e94f2258f",
|
||||
"MD5" : "b1946ac92492d2347c6235b4d2611184",
|
||||
"DropboxHash" : "ecb65bb98f9d905b70458986c39fcbad7715e5f2fcc3b1f07767d7c83e2438cc"
|
||||
},
|
||||
"IsDir" : false,
|
||||
"ModTime" : "2017-05-31T16:15:57.034468261+01:00",
|
||||
"Name" : "file.txt",
|
||||
"Path" : "full/path/goes/here/file.txt",
|
||||
"Size" : 6
|
||||
}
|
||||
|
||||
If --hash is not specified the the Hashes property won't be emitted.
|
||||
|
||||
If --no-modtime is specified then ModTime will be blank.
|
||||
|
||||
The time is in RFC3339 format with nanosecond precision.
|
||||
|
||||
The whole output can be processed as a JSON blob, or alternatively it
|
||||
can be processed line by line as each item is written one to a line.
|
||||
`,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(1, 1, command, args)
|
||||
fsrc := cmd.NewFsSrc(args)
|
||||
cmd.Run(false, false, command, func() error {
|
||||
fmt.Println("[")
|
||||
first := true
|
||||
err := fs.Walk(fsrc, "", false, fs.ConfigMaxDepth(recurse), func(dirPath string, entries fs.DirEntries, err error) error {
|
||||
if err != nil {
|
||||
fs.Stats.Error()
|
||||
fs.Errorf(dirPath, "error listing: %v", err)
|
||||
return nil
|
||||
}
|
||||
for _, entry := range entries {
|
||||
item := lsJSON{
|
||||
Path: entry.Remote(),
|
||||
Name: path.Base(entry.Remote()),
|
||||
Size: entry.Size(),
|
||||
}
|
||||
if !noModTime {
|
||||
item.ModTime = Timestamp(entry.ModTime())
|
||||
}
|
||||
switch x := entry.(type) {
|
||||
case fs.Directory:
|
||||
item.IsDir = true
|
||||
case fs.Object:
|
||||
item.IsDir = false
|
||||
if showHash {
|
||||
item.Hashes = make(map[string]string)
|
||||
for _, hashType := range x.Fs().Hashes().Array() {
|
||||
hash, err := x.Hash(hashType)
|
||||
if err != nil {
|
||||
fs.Errorf(x, "Failed to read hash: %v", err)
|
||||
} else if hash != "" {
|
||||
item.Hashes[hashType.String()] = hash
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
fs.Errorf(nil, "Unknown type %T in listing", entry)
|
||||
}
|
||||
out, err := json.Marshal(item)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to marshal list object")
|
||||
}
|
||||
if first {
|
||||
first = false
|
||||
} else {
|
||||
fmt.Print(",\n")
|
||||
}
|
||||
_, err = os.Stdout.Write(out)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to write to output")
|
||||
}
|
||||
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error listing JSON")
|
||||
}
|
||||
if !first {
|
||||
fmt.Println()
|
||||
}
|
||||
fmt.Println("]")
|
||||
return nil
|
||||
})
|
||||
},
|
||||
}
|
||||
+81
-330
@@ -5,11 +5,11 @@ package mount
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"bazil.org/fuse"
|
||||
fusefs "bazil.org/fuse/fs"
|
||||
"github.com/ncw/rclone/cmd/mountlib"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/net/context"
|
||||
@@ -21,191 +21,57 @@ import (
|
||||
//
|
||||
// node may be nil, but o may not
|
||||
type DirEntry struct {
|
||||
o fs.BasicInfo
|
||||
o fs.DirEntry
|
||||
node fusefs.Node
|
||||
}
|
||||
|
||||
// Dir represents a directory entry
|
||||
type Dir struct {
|
||||
f fs.Fs
|
||||
path string
|
||||
modTime time.Time
|
||||
mu sync.RWMutex // protects the following
|
||||
read time.Time // time directory entry last read
|
||||
items map[string]*DirEntry
|
||||
}
|
||||
|
||||
func newDir(f fs.Fs, fsDir *fs.Dir) *Dir {
|
||||
return &Dir{
|
||||
f: f,
|
||||
path: fsDir.Name,
|
||||
modTime: fsDir.When,
|
||||
}
|
||||
}
|
||||
|
||||
// rename should be called after the directory is renamed
|
||||
//
|
||||
// Reset the directory to new state, discarding all the objects and
|
||||
// reading everything again
|
||||
func (d *Dir) rename(newParent *Dir, fsDir *fs.Dir) {
|
||||
d.path = fsDir.Name
|
||||
d.modTime = fsDir.When
|
||||
d.items = nil
|
||||
d.read = time.Time{}
|
||||
}
|
||||
|
||||
// addObject adds a new object or directory to the directory
|
||||
//
|
||||
// note that we add new objects rather than updating old ones
|
||||
func (d *Dir) addObject(o fs.BasicInfo, node fusefs.Node) *DirEntry {
|
||||
item := &DirEntry{
|
||||
o: o,
|
||||
node: node,
|
||||
}
|
||||
d.mu.Lock()
|
||||
d.items[path.Base(o.Remote())] = item
|
||||
d.mu.Unlock()
|
||||
return item
|
||||
}
|
||||
|
||||
// delObject removes an object from the directory
|
||||
func (d *Dir) delObject(leaf string) {
|
||||
d.mu.Lock()
|
||||
delete(d.items, leaf)
|
||||
d.mu.Unlock()
|
||||
}
|
||||
|
||||
// read the directory
|
||||
func (d *Dir) readDir() error {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
when := time.Now()
|
||||
if d.read.IsZero() {
|
||||
fs.Debugf(d.path, "Reading directory")
|
||||
} else {
|
||||
age := when.Sub(d.read)
|
||||
if age < dirCacheTime {
|
||||
return nil
|
||||
}
|
||||
fs.Debugf(d.path, "Re-reading directory (%v old)", age)
|
||||
}
|
||||
entries, err := fs.ListDirSorted(d.f, false, d.path)
|
||||
if err == fs.ErrorDirNotFound {
|
||||
// We treat directory not found as empty because we
|
||||
// create directories on the fly
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
// NB when we re-read a directory after its cache has expired
|
||||
// we drop the old files which should lead to correct
|
||||
// behaviour but may not be very efficient.
|
||||
|
||||
// Keep a note of the previous contents of the directory
|
||||
oldItems := d.items
|
||||
|
||||
// Cache the items by name
|
||||
d.items = make(map[string]*DirEntry, len(entries))
|
||||
for _, entry := range entries {
|
||||
switch item := entry.(type) {
|
||||
case fs.Object:
|
||||
obj := item
|
||||
name := path.Base(obj.Remote())
|
||||
d.items[name] = &DirEntry{
|
||||
o: obj,
|
||||
node: nil,
|
||||
}
|
||||
case *fs.Dir:
|
||||
dir := item
|
||||
name := path.Base(dir.Remote())
|
||||
// Use old dir value if it exists
|
||||
if oldItem, ok := oldItems[name]; ok {
|
||||
if _, ok := oldItem.o.(*fs.Dir); ok {
|
||||
d.items[name] = oldItem
|
||||
continue
|
||||
}
|
||||
}
|
||||
d.items[name] = &DirEntry{
|
||||
o: dir,
|
||||
node: nil,
|
||||
}
|
||||
default:
|
||||
err = errors.Errorf("unknown type %T", item)
|
||||
fs.Errorf(d.path, "readDir error: %v", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
d.read = when
|
||||
return nil
|
||||
}
|
||||
|
||||
// lookup a single item in the directory
|
||||
//
|
||||
// returns fuse.ENOENT if not found.
|
||||
func (d *Dir) lookup(leaf string) (*DirEntry, error) {
|
||||
err := d.readDir()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
d.mu.RLock()
|
||||
item, ok := d.items[leaf]
|
||||
d.mu.RUnlock()
|
||||
if !ok {
|
||||
return nil, fuse.ENOENT
|
||||
}
|
||||
return item, nil
|
||||
}
|
||||
|
||||
// Check to see if a directory is empty
|
||||
func (d *Dir) isEmpty() (bool, error) {
|
||||
err := d.readDir()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
d.mu.RLock()
|
||||
defer d.mu.RUnlock()
|
||||
return len(d.items) == 0, nil
|
||||
*mountlib.Dir
|
||||
// f fs.Fs
|
||||
// path string
|
||||
// modTime time.Time
|
||||
// mu sync.RWMutex // protects the following
|
||||
// read time.Time // time directory entry last read
|
||||
// items map[string]*DirEntry
|
||||
}
|
||||
|
||||
// Check interface satsified
|
||||
var _ fusefs.Node = (*Dir)(nil)
|
||||
|
||||
// Attr updates the attribes of a directory
|
||||
func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
a.Gid = gid
|
||||
a.Uid = uid
|
||||
a.Mode = os.ModeDir | dirPerms
|
||||
a.Atime = d.modTime
|
||||
a.Mtime = d.modTime
|
||||
a.Ctime = d.modTime
|
||||
a.Crtime = d.modTime
|
||||
// Attr updates the attributes of a directory
|
||||
func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) (err error) {
|
||||
defer fs.Trace(d, "")("attr=%+v, err=%v", a, &err)
|
||||
a.Gid = mountlib.GID
|
||||
a.Uid = mountlib.UID
|
||||
a.Mode = os.ModeDir | mountlib.DirPerms
|
||||
modTime := d.ModTime()
|
||||
a.Atime = modTime
|
||||
a.Mtime = modTime
|
||||
a.Ctime = modTime
|
||||
a.Crtime = modTime
|
||||
// FIXME include Valid so get some caching?
|
||||
fs.Debugf(d.path, "Dir.Attr %+v", a)
|
||||
// FIXME fs.Debugf(d.path, "Dir.Attr %+v", a)
|
||||
return nil
|
||||
}
|
||||
|
||||
// lookupNode calls lookup then makes sure the node is not nil in the DirEntry
|
||||
func (d *Dir) lookupNode(leaf string) (item *DirEntry, err error) {
|
||||
item, err = d.lookup(leaf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
// Check interface satisfied
|
||||
var _ fusefs.NodeSetattrer = (*Dir)(nil)
|
||||
|
||||
// Setattr handles attribute changes from FUSE. Currently supports ModTime only.
|
||||
func (d *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) (err error) {
|
||||
defer fs.Trace(d, "stat=%+v", req)("err=%v", &err)
|
||||
if mountlib.NoModTime {
|
||||
return nil
|
||||
}
|
||||
if item.node != nil {
|
||||
return item, nil
|
||||
|
||||
if req.Valid.MtimeNow() {
|
||||
err = d.SetModTime(time.Now())
|
||||
} else if req.Valid.Mtime() {
|
||||
err = d.SetModTime(req.Mtime)
|
||||
}
|
||||
var node fusefs.Node
|
||||
switch x := item.o.(type) {
|
||||
case fs.Object:
|
||||
node, err = newFile(d, x), nil
|
||||
case *fs.Dir:
|
||||
node, err = newDir(d.f, x), nil
|
||||
default:
|
||||
err = errors.Errorf("unknown type %T", item)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
item = d.addObject(item.o, node)
|
||||
return item, nil
|
||||
|
||||
return translateError(err)
|
||||
}
|
||||
|
||||
// Check interface satisfied
|
||||
@@ -218,17 +84,18 @@ var _ fusefs.NodeRequestLookuper = (*Dir)(nil)
|
||||
//
|
||||
// Lookup need not to handle the names "." and "..".
|
||||
func (d *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (node fusefs.Node, err error) {
|
||||
path := path.Join(d.path, req.Name)
|
||||
fs.Debugf(path, "Dir.Lookup")
|
||||
item, err := d.lookupNode(req.Name)
|
||||
defer fs.Trace(d, "name=%q", req.Name)("node=%+v, err=%v", &node, &err)
|
||||
mnode, err := d.Dir.Lookup(req.Name)
|
||||
if err != nil {
|
||||
if err != fuse.ENOENT {
|
||||
fs.Errorf(path, "Dir.Lookup error: %v", err)
|
||||
}
|
||||
return nil, err
|
||||
return nil, translateError(err)
|
||||
}
|
||||
fs.Debugf(path, "Dir.Lookup OK")
|
||||
return item.node, nil
|
||||
switch x := mnode.(type) {
|
||||
case *mountlib.File:
|
||||
return &File{x}, nil
|
||||
case *mountlib.Dir:
|
||||
return &Dir{x}, nil
|
||||
}
|
||||
panic("bad type")
|
||||
}
|
||||
|
||||
// Check interface satisfied
|
||||
@@ -236,77 +103,58 @@ var _ fusefs.HandleReadDirAller = (*Dir)(nil)
|
||||
|
||||
// ReadDirAll reads the contents of the directory
|
||||
func (d *Dir) ReadDirAll(ctx context.Context) (dirents []fuse.Dirent, err error) {
|
||||
fs.Debugf(d.path, "Dir.ReadDirAll")
|
||||
err = d.readDir()
|
||||
itemsRead := -1
|
||||
defer fs.Trace(d, "")("item=%d, err=%v", &itemsRead, &err)
|
||||
items, err := d.Dir.ReadDirAll()
|
||||
if err != nil {
|
||||
fs.Debugf(d.path, "Dir.ReadDirAll error: %v", err)
|
||||
return nil, err
|
||||
return nil, translateError(err)
|
||||
}
|
||||
d.mu.RLock()
|
||||
defer d.mu.RUnlock()
|
||||
for _, item := range d.items {
|
||||
for _, item := range items {
|
||||
var dirent fuse.Dirent
|
||||
switch x := item.o.(type) {
|
||||
switch x := item.Obj.(type) {
|
||||
case fs.Object:
|
||||
dirent = fuse.Dirent{
|
||||
// Inode FIXME ???
|
||||
Type: fuse.DT_File,
|
||||
Name: path.Base(x.Remote()),
|
||||
}
|
||||
case *fs.Dir:
|
||||
case fs.Directory:
|
||||
dirent = fuse.Dirent{
|
||||
// Inode FIXME ???
|
||||
Type: fuse.DT_Dir,
|
||||
Name: path.Base(x.Remote()),
|
||||
}
|
||||
default:
|
||||
err = errors.Errorf("unknown type %T", item)
|
||||
fs.Errorf(d.path, "Dir.ReadDirAll error: %v", err)
|
||||
return nil, err
|
||||
return nil, errors.Errorf("unknown type %T", item)
|
||||
}
|
||||
dirents = append(dirents, dirent)
|
||||
}
|
||||
fs.Debugf(d.path, "Dir.ReadDirAll OK with %d entries", len(dirents))
|
||||
itemsRead = len(dirents)
|
||||
return dirents, nil
|
||||
}
|
||||
|
||||
var _ fusefs.NodeCreater = (*Dir)(nil)
|
||||
|
||||
// Create makes a new file
|
||||
func (d *Dir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fusefs.Node, fusefs.Handle, error) {
|
||||
path := path.Join(d.path, req.Name)
|
||||
fs.Debugf(path, "Dir.Create")
|
||||
src := newCreateInfo(d.f, path)
|
||||
// This gets added to the directory when the file is written
|
||||
file := newFile(d, nil)
|
||||
fh, err := newWriteFileHandle(d, file, src)
|
||||
func (d *Dir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (node fusefs.Node, handle fusefs.Handle, err error) {
|
||||
defer fs.Trace(d, "name=%q", req.Name)("node=%v, handle=%v, err=%v", &node, &handle, &err)
|
||||
file, fh, err := d.Dir.Create(req.Name)
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Create error: %v", err)
|
||||
return nil, nil, err
|
||||
return nil, nil, translateError(err)
|
||||
}
|
||||
fs.Debugf(path, "Dir.Create OK")
|
||||
return file, fh, nil
|
||||
return &File{file}, &WriteFileHandle{fh}, err
|
||||
}
|
||||
|
||||
var _ fusefs.NodeMkdirer = (*Dir)(nil)
|
||||
|
||||
// Mkdir creates a new directory
|
||||
func (d *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fusefs.Node, error) {
|
||||
path := path.Join(d.path, req.Name)
|
||||
fs.Debugf(path, "Dir.Mkdir")
|
||||
err := d.f.Mkdir(path)
|
||||
func (d *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (node fusefs.Node, err error) {
|
||||
defer fs.Trace(d, "name=%q", req.Name)("node=%+v, err=%v", &node, &err)
|
||||
dir, err := d.Dir.Mkdir(req.Name)
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Mkdir failed to create directory: %v", err)
|
||||
return nil, err
|
||||
return nil, translateError(err)
|
||||
}
|
||||
fsDir := &fs.Dir{
|
||||
Name: path,
|
||||
When: time.Now(),
|
||||
}
|
||||
dir := newDir(d.f, fsDir)
|
||||
d.addObject(fsDir, dir)
|
||||
fs.Debugf(path, "Dir.Mkdir OK")
|
||||
return dir, nil
|
||||
return &Dir{dir}, nil
|
||||
}
|
||||
|
||||
var _ fusefs.NodeRemover = (*Dir)(nil)
|
||||
@@ -314,47 +162,12 @@ var _ fusefs.NodeRemover = (*Dir)(nil)
|
||||
// Remove removes the entry with the given name from
|
||||
// the receiver, which must be a directory. The entry to be removed
|
||||
// may correspond to a file (unlink) or to a directory (rmdir).
|
||||
func (d *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
|
||||
path := path.Join(d.path, req.Name)
|
||||
fs.Debugf(path, "Dir.Remove")
|
||||
item, err := d.lookupNode(req.Name)
|
||||
func (d *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) (err error) {
|
||||
defer fs.Trace(d, "name=%q", req.Name)("err=%v", &err)
|
||||
err = d.Dir.Remove(req.Name)
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Remove error: %v", err)
|
||||
return err
|
||||
return translateError(err)
|
||||
}
|
||||
switch x := item.o.(type) {
|
||||
case fs.Object:
|
||||
err = x.Remove()
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Remove file error: %v", err)
|
||||
return err
|
||||
}
|
||||
case *fs.Dir:
|
||||
// Check directory is empty first
|
||||
dir := item.node.(*Dir)
|
||||
empty, err := dir.isEmpty()
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Remove dir error: %v", err)
|
||||
return err
|
||||
}
|
||||
if !empty {
|
||||
// return fuse.ENOTEMPTY - doesn't exist though so use EEXIST
|
||||
fs.Errorf(path, "Dir.Remove not empty")
|
||||
return fuse.EEXIST
|
||||
}
|
||||
// remove directory
|
||||
err = d.f.Rmdir(path)
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Remove failed to remove directory: %v", err)
|
||||
return err
|
||||
}
|
||||
default:
|
||||
fs.Errorf(path, "Dir.Remove unknown type %T", item)
|
||||
return errors.Errorf("unknown type %T", item)
|
||||
}
|
||||
// Remove the item from the directory listing
|
||||
d.delObject(req.Name)
|
||||
fs.Debugf(path, "Dir.Remove OK")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -362,83 +175,18 @@ func (d *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
|
||||
var _ fusefs.NodeRenamer = (*Dir)(nil)
|
||||
|
||||
// Rename the file
|
||||
func (d *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fusefs.Node) error {
|
||||
oldPath := path.Join(d.path, req.OldName)
|
||||
func (d *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fusefs.Node) (err error) {
|
||||
defer fs.Trace(d, "oldName=%q, newName=%q, newDir=%+v", req.OldName, req.NewName, newDir)("err=%v", &err)
|
||||
destDir, ok := newDir.(*Dir)
|
||||
if !ok {
|
||||
err := errors.Errorf("Unknown Dir type %T", newDir)
|
||||
fs.Errorf(oldPath, "Dir.Rename error: %v", err)
|
||||
return err
|
||||
return errors.Errorf("Unknown Dir type %T", newDir)
|
||||
}
|
||||
newPath := path.Join(destDir.path, req.NewName)
|
||||
fs.Debugf(oldPath, "Dir.Rename to %q", newPath)
|
||||
oldItem, err := d.lookupNode(req.OldName)
|
||||
|
||||
err = d.Dir.Rename(req.OldName, req.NewName, destDir.Dir)
|
||||
if err != nil {
|
||||
fs.Errorf(oldPath, "Dir.Rename error: %v", err)
|
||||
return err
|
||||
}
|
||||
var newObj fs.BasicInfo
|
||||
oldNode := oldItem.node
|
||||
switch x := oldItem.o.(type) {
|
||||
case fs.Object:
|
||||
oldObject := x
|
||||
// FIXME: could Copy then Delete if Move not available
|
||||
// - though care needed if case insensitive...
|
||||
doMove := d.f.Features().Move
|
||||
if doMove == nil {
|
||||
err := errors.Errorf("Fs %q can't rename files (no Move)", d.f)
|
||||
fs.Errorf(oldPath, "Dir.Rename error: %v", err)
|
||||
return err
|
||||
}
|
||||
newObject, err := doMove(oldObject, newPath)
|
||||
if err != nil {
|
||||
fs.Errorf(oldPath, "Dir.Rename error: %v", err)
|
||||
return err
|
||||
}
|
||||
newObj = newObject
|
||||
// Update the node with the new details
|
||||
if oldNode != nil {
|
||||
if oldFile, ok := oldNode.(*File); ok {
|
||||
fs.Debugf(oldItem.o, "Updating file with %v %p", newObject, oldFile)
|
||||
oldFile.rename(destDir, newObject)
|
||||
}
|
||||
}
|
||||
case *fs.Dir:
|
||||
doDirMove := d.f.Features().DirMove
|
||||
if doDirMove == nil {
|
||||
err := errors.Errorf("Fs %q can't rename directories (no DirMove)", d.f)
|
||||
fs.Errorf(oldPath, "Dir.Rename error: %v", err)
|
||||
return err
|
||||
}
|
||||
srcRemote := x.Name
|
||||
dstRemote := newPath
|
||||
err = doDirMove(d.f, srcRemote, dstRemote)
|
||||
if err != nil {
|
||||
fs.Errorf(oldPath, "Dir.Rename error: %v", err)
|
||||
return err
|
||||
}
|
||||
newDir := new(fs.Dir)
|
||||
*newDir = *x
|
||||
newDir.Name = newPath
|
||||
newObj = newDir
|
||||
// Update the node with the new details
|
||||
if oldNode != nil {
|
||||
if oldDir, ok := oldNode.(*Dir); ok {
|
||||
fs.Debugf(oldItem.o, "Updating dir with %v %p", newDir, oldDir)
|
||||
oldDir.rename(destDir, newDir)
|
||||
}
|
||||
}
|
||||
default:
|
||||
err = errors.Errorf("unknown type %T", oldItem)
|
||||
fs.Errorf(d.path, "Dir.ReadDirAll error: %v", err)
|
||||
return err
|
||||
return translateError(err)
|
||||
}
|
||||
|
||||
// Show moved - delete from old dir and add to new
|
||||
d.delObject(req.OldName)
|
||||
destDir.addObject(newObj, oldNode)
|
||||
|
||||
fs.Debugf(newPath, "Dir.Rename renamed from %q", oldPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -446,8 +194,11 @@ func (d *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fusefs
|
||||
var _ fusefs.NodeFsyncer = (*Dir)(nil)
|
||||
|
||||
// Fsync the directory
|
||||
//
|
||||
// Note that we don't do anything except return OK
|
||||
func (d *Dir) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
|
||||
func (d *Dir) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error) {
|
||||
defer fs.Trace(d, "")("err=%v", &err)
|
||||
err = d.Dir.Fsync()
|
||||
if err != nil {
|
||||
return translateError(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
+46
-96
@@ -3,12 +3,11 @@
|
||||
package mount
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"bazil.org/fuse"
|
||||
fusefs "bazil.org/fuse/fs"
|
||||
"github.com/ncw/rclone/cmd/mountlib"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/net/context"
|
||||
@@ -16,96 +15,52 @@ import (
|
||||
|
||||
// File represents a file
|
||||
type File struct {
|
||||
size int64 // size of file - read and written with atomic int64 - must be 64 bit aligned
|
||||
d *Dir // parent directory - read only
|
||||
mu sync.RWMutex // protects the following
|
||||
o fs.Object // NB o may be nil if file is being written
|
||||
writers int // number of writers for this file
|
||||
}
|
||||
|
||||
// newFile creates a new File
|
||||
func newFile(d *Dir, o fs.Object) *File {
|
||||
return &File{
|
||||
d: d,
|
||||
o: o,
|
||||
}
|
||||
}
|
||||
|
||||
// rename should be called to update f.o and f.d after a rename
|
||||
func (f *File) rename(d *Dir, o fs.Object) {
|
||||
f.mu.Lock()
|
||||
f.o = o
|
||||
f.d = d
|
||||
f.mu.Unlock()
|
||||
}
|
||||
|
||||
// addWriters increments or decrements the writers
|
||||
func (f *File) addWriters(n int) {
|
||||
f.mu.Lock()
|
||||
f.writers += n
|
||||
f.mu.Unlock()
|
||||
*mountlib.File
|
||||
// size int64 // size of file - read and written with atomic int64 - must be 64 bit aligned
|
||||
// d *Dir // parent directory - read only
|
||||
// mu sync.RWMutex // protects the following
|
||||
// o fs.Object // NB o may be nil if file is being written
|
||||
// writers int // number of writers for this file
|
||||
// pendingModTime time.Time // will be applied once o becomes available, i.e. after file was written
|
||||
}
|
||||
|
||||
// Check interface satisfied
|
||||
var _ fusefs.Node = (*File)(nil)
|
||||
|
||||
// Attr fills out the attributes for the file
|
||||
func (f *File) Attr(ctx context.Context, a *fuse.Attr) error {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
a.Gid = gid
|
||||
a.Uid = uid
|
||||
a.Mode = filePerms
|
||||
// if o is nil it isn't valid yet, so return the size so far
|
||||
if f.o == nil {
|
||||
a.Size = uint64(atomic.LoadInt64(&f.size))
|
||||
} else {
|
||||
a.Size = uint64(f.o.Size())
|
||||
if !noModTime {
|
||||
modTime := f.o.ModTime()
|
||||
a.Atime = modTime
|
||||
a.Mtime = modTime
|
||||
a.Ctime = modTime
|
||||
a.Crtime = modTime
|
||||
}
|
||||
func (f *File) Attr(ctx context.Context, a *fuse.Attr) (err error) {
|
||||
defer fs.Trace(f, "")("a=%+v, err=%v", a, &err)
|
||||
modTime, Size, Blocks, err := f.File.Attr(mountlib.NoModTime)
|
||||
if err != nil {
|
||||
return translateError(err)
|
||||
}
|
||||
a.Blocks = (a.Size + 511) / 512
|
||||
fs.Debugf(f.o, "File.Attr %+v", a)
|
||||
a.Gid = mountlib.GID
|
||||
a.Uid = mountlib.UID
|
||||
a.Mode = mountlib.FilePerms
|
||||
a.Size = Size
|
||||
a.Atime = modTime
|
||||
a.Mtime = modTime
|
||||
a.Ctime = modTime
|
||||
a.Crtime = modTime
|
||||
a.Blocks = Blocks
|
||||
return nil
|
||||
}
|
||||
|
||||
// Update the size while writing
|
||||
func (f *File) written(n int64) {
|
||||
atomic.AddInt64(&f.size, n)
|
||||
}
|
||||
// Check interface satisfied
|
||||
var _ fusefs.NodeSetattrer = (*File)(nil)
|
||||
|
||||
// Update the object when written
|
||||
func (f *File) setObject(o fs.Object) {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
f.o = o
|
||||
f.d.addObject(o, f)
|
||||
}
|
||||
|
||||
// Wait for f.o to become non nil for a short time returning it or an
|
||||
// error
|
||||
//
|
||||
// Call without the mutex held
|
||||
func (f *File) waitForValidObject() (o fs.Object, err error) {
|
||||
for i := 0; i < 50; i++ {
|
||||
f.mu.Lock()
|
||||
o = f.o
|
||||
writers := f.writers
|
||||
f.mu.Unlock()
|
||||
if o != nil {
|
||||
return o, nil
|
||||
}
|
||||
if writers == 0 {
|
||||
return nil, errors.New("can't open file - writer failed")
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
// Setattr handles attribute changes from FUSE. Currently supports ModTime only.
|
||||
func (f *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) (err error) {
|
||||
defer fs.Trace(f, "a=%+v", req)("err=%v", &err)
|
||||
if mountlib.NoModTime {
|
||||
return nil
|
||||
}
|
||||
return nil, fuse.ENOENT
|
||||
if req.Valid.MtimeNow() {
|
||||
err = f.File.SetModTime(time.Now())
|
||||
} else if req.Valid.Mtime() {
|
||||
err = f.File.SetModTime(req.Mtime)
|
||||
}
|
||||
return translateError(err)
|
||||
}
|
||||
|
||||
// Check interface satisfied
|
||||
@@ -113,25 +68,20 @@ var _ fusefs.NodeOpener = (*File)(nil)
|
||||
|
||||
// Open the file for read or write
|
||||
func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fh fusefs.Handle, err error) {
|
||||
// if o is nil it isn't valid yet
|
||||
o, err := f.waitForValidObject()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fs.Debugf(o, "File.Open %v", req.Flags)
|
||||
|
||||
defer fs.Trace(f, "flags=%v", req.Flags)("fh=%v, err=%v", &fh, &err)
|
||||
switch {
|
||||
case req.Flags.IsReadOnly():
|
||||
if noSeek {
|
||||
if mountlib.NoSeek {
|
||||
resp.Flags |= fuse.OpenNonSeekable
|
||||
}
|
||||
fh, err = newReadFileHandle(o)
|
||||
err = errors.Wrap(err, "open for read")
|
||||
var rfh *mountlib.ReadFileHandle
|
||||
rfh, err = f.File.OpenRead()
|
||||
fh = &ReadFileHandle{rfh}
|
||||
case req.Flags.IsWriteOnly() || (req.Flags.IsReadWrite() && (req.Flags&fuse.OpenTruncate) != 0):
|
||||
resp.Flags |= fuse.OpenNonSeekable
|
||||
src := newCreateInfo(f.d.f, o.Remote())
|
||||
fh, err = newWriteFileHandle(f.d, f, src)
|
||||
err = errors.Wrap(err, "open for write")
|
||||
var wfh *mountlib.WriteFileHandle
|
||||
wfh, err = f.File.OpenWrite()
|
||||
fh = &WriteFileHandle{wfh}
|
||||
case req.Flags.IsReadWrite():
|
||||
err = errors.New("can't open for read and write simultaneously")
|
||||
default:
|
||||
@@ -151,8 +101,7 @@ func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenR
|
||||
*/
|
||||
|
||||
if err != nil {
|
||||
fs.Errorf(o, "File.Open failed: %v", err)
|
||||
return nil, err
|
||||
return nil, translateError(err)
|
||||
}
|
||||
return fh, nil
|
||||
}
|
||||
@@ -163,6 +112,7 @@ var _ fusefs.NodeFsyncer = (*File)(nil)
|
||||
// Fsync the file
|
||||
//
|
||||
// Note that we don't do anything except return OK
|
||||
func (f *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
|
||||
func (f *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error) {
|
||||
defer fs.Trace(f, "")("err=%v", &err)
|
||||
return nil
|
||||
}
|
||||
+47
-83
@@ -5,106 +5,42 @@
|
||||
package mount
|
||||
|
||||
import (
|
||||
"time"
|
||||
"syscall"
|
||||
|
||||
"bazil.org/fuse"
|
||||
fusefs "bazil.org/fuse/fs"
|
||||
"github.com/ncw/rclone/cmd/mountlib"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// FS represents the top level filing system
|
||||
type FS struct {
|
||||
*mountlib.FS
|
||||
f fs.Fs
|
||||
}
|
||||
|
||||
// Check interface satistfied
|
||||
var _ fusefs.FS = (*FS)(nil)
|
||||
|
||||
// NewFS makes a new FS
|
||||
func NewFS(f fs.Fs) *FS {
|
||||
fsys := &FS{
|
||||
FS: mountlib.NewFS(f),
|
||||
f: f,
|
||||
}
|
||||
return fsys
|
||||
}
|
||||
|
||||
// Root returns the root node
|
||||
func (f *FS) Root() (fusefs.Node, error) {
|
||||
fs.Debugf(f.f, "Root()")
|
||||
fsDir := &fs.Dir{
|
||||
Name: "",
|
||||
When: time.Now(),
|
||||
}
|
||||
return newDir(f.f, fsDir), nil
|
||||
}
|
||||
|
||||
// mountOptions configures the options from the command line flags
|
||||
func mountOptions(device string) (options []fuse.MountOption) {
|
||||
options = []fuse.MountOption{
|
||||
fuse.MaxReadahead(uint32(maxReadAhead)),
|
||||
fuse.Subtype("rclone"),
|
||||
fuse.FSName(device), fuse.VolumeName(device),
|
||||
fuse.NoAppleDouble(),
|
||||
fuse.NoAppleXattr(),
|
||||
|
||||
// Options from benchmarking in the fuse module
|
||||
//fuse.MaxReadahead(64 * 1024 * 1024),
|
||||
//fuse.AsyncRead(), - FIXME this causes
|
||||
// ReadFileHandle.Read error: read /home/files/ISOs/xubuntu-15.10-desktop-amd64.iso: bad file descriptor
|
||||
// which is probably related to errors people are having
|
||||
//fuse.WritebackCache(),
|
||||
}
|
||||
if allowNonEmpty {
|
||||
options = append(options, fuse.AllowNonEmptyMount())
|
||||
}
|
||||
if allowOther {
|
||||
options = append(options, fuse.AllowOther())
|
||||
}
|
||||
if allowRoot {
|
||||
options = append(options, fuse.AllowRoot())
|
||||
}
|
||||
if defaultPermissions {
|
||||
options = append(options, fuse.DefaultPermissions())
|
||||
}
|
||||
if readOnly {
|
||||
options = append(options, fuse.ReadOnly())
|
||||
}
|
||||
if writebackCache {
|
||||
options = append(options, fuse.WritebackCache())
|
||||
}
|
||||
return options
|
||||
}
|
||||
|
||||
// mount the file system
|
||||
//
|
||||
// The mount point will be ready when this returns.
|
||||
//
|
||||
// returns an error, and an error channel for the serve process to
|
||||
// report an error when fusermount is called.
|
||||
func mount(f fs.Fs, mountpoint string) (<-chan error, error) {
|
||||
fs.Debugf(f, "Mounting on %q", mountpoint)
|
||||
c, err := fuse.Mount(mountpoint, mountOptions(f.Name()+":"+f.Root())...)
|
||||
func (f *FS) Root() (node fusefs.Node, err error) {
|
||||
defer fs.Trace("", "")("node=%+v, err=%v", &node, &err)
|
||||
root, err := f.FS.Root()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, translateError(err)
|
||||
}
|
||||
|
||||
filesys := &FS{
|
||||
f: f,
|
||||
}
|
||||
|
||||
server := fusefs.New(c, nil)
|
||||
|
||||
// Serve the mount point in the background returning error to errChan
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
err := server.Serve(filesys)
|
||||
closeErr := c.Close()
|
||||
if err == nil {
|
||||
err = closeErr
|
||||
}
|
||||
errChan <- err
|
||||
}()
|
||||
|
||||
// check if the mount process has an error to report
|
||||
<-c.Ready
|
||||
if err := c.MountError; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return errChan, nil
|
||||
return &Dir{root}, nil
|
||||
}
|
||||
|
||||
// Check interface satsified
|
||||
@@ -112,7 +48,8 @@ var _ fusefs.FSStatfser = (*FS)(nil)
|
||||
|
||||
// Statfs is called to obtain file system metadata.
|
||||
// It should write that data to resp.
|
||||
func (f *FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error {
|
||||
func (f *FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) (err error) {
|
||||
defer fs.Trace("", "")("stat=%+v, err=%v", resp, &err)
|
||||
const blockSize = 4096
|
||||
const fsBlocks = (1 << 50) / blockSize
|
||||
resp.Blocks = fsBlocks // Total data blocks in file system.
|
||||
@@ -125,3 +62,30 @@ func (f *FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.Sta
|
||||
resp.Frsize = blockSize // Fragment size, smallest addressable data size in the file system.
|
||||
return nil
|
||||
}
|
||||
|
||||
// Translate errors from mountlib
|
||||
func translateError(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
cause := errors.Cause(err)
|
||||
if mErr, ok := cause.(mountlib.Error); ok {
|
||||
switch mErr {
|
||||
case mountlib.OK:
|
||||
return nil
|
||||
case mountlib.ENOENT:
|
||||
return fuse.ENOENT
|
||||
case mountlib.ENOTEMPTY:
|
||||
return fuse.Errno(syscall.ENOTEMPTY)
|
||||
case mountlib.EEXIST:
|
||||
return fuse.EEXIST
|
||||
case mountlib.ESPIPE:
|
||||
return fuse.Errno(syscall.ESPIPE)
|
||||
case mountlib.EBADF:
|
||||
return fuse.Errno(syscall.EBADF)
|
||||
case mountlib.EROFS:
|
||||
return fuse.Errno(syscall.EROFS)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
+109
-134
@@ -5,171 +5,146 @@
|
||||
package mount
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"github.com/ncw/rclone/cmd"
|
||||
fusefs "bazil.org/fuse/fs"
|
||||
"github.com/ncw/rclone/cmd/mountlib"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// Globals
|
||||
var (
|
||||
noModTime = false
|
||||
debugFUSE = false
|
||||
noSeek = false
|
||||
dirCacheTime = 5 * 60 * time.Second
|
||||
// mount options
|
||||
readOnly = false
|
||||
allowNonEmpty = false
|
||||
allowRoot = false
|
||||
allowOther = false
|
||||
defaultPermissions = false
|
||||
writebackCache = false
|
||||
maxReadAhead fs.SizeSuffix = 128 * 1024
|
||||
umask = 0
|
||||
uid = uint32(unix.Geteuid())
|
||||
gid = uint32(unix.Getegid())
|
||||
// foreground = false
|
||||
// default permissions for directories - modified by umask in Mount
|
||||
dirPerms = os.FileMode(0777)
|
||||
filePerms = os.FileMode(0666)
|
||||
)
|
||||
|
||||
func init() {
|
||||
umask = unix.Umask(0) // read the umask
|
||||
unix.Umask(umask) // set it back to what it was
|
||||
cmd.Root.AddCommand(commandDefintion)
|
||||
commandDefintion.Flags().BoolVarP(&noModTime, "no-modtime", "", noModTime, "Don't read the modification time (can speed things up).")
|
||||
commandDefintion.Flags().BoolVarP(&debugFUSE, "debug-fuse", "", debugFUSE, "Debug the FUSE internals - needs -v.")
|
||||
commandDefintion.Flags().BoolVarP(&noSeek, "no-seek", "", noSeek, "Don't allow seeking in files.")
|
||||
commandDefintion.Flags().DurationVarP(&dirCacheTime, "dir-cache-time", "", dirCacheTime, "Time to cache directory entries for.")
|
||||
// mount options
|
||||
commandDefintion.Flags().BoolVarP(&readOnly, "read-only", "", readOnly, "Mount read-only.")
|
||||
commandDefintion.Flags().BoolVarP(&allowNonEmpty, "allow-non-empty", "", allowNonEmpty, "Allow mounting over a non-empty directory.")
|
||||
commandDefintion.Flags().BoolVarP(&allowRoot, "allow-root", "", allowRoot, "Allow access to root user.")
|
||||
commandDefintion.Flags().BoolVarP(&allowOther, "allow-other", "", allowOther, "Allow access to other users.")
|
||||
commandDefintion.Flags().BoolVarP(&defaultPermissions, "default-permissions", "", defaultPermissions, "Makes kernel enforce access control based on the file mode.")
|
||||
commandDefintion.Flags().BoolVarP(&writebackCache, "write-back-cache", "", writebackCache, "Makes kernel buffer writes before sending them to rclone. Without this, writethrough caching is used.")
|
||||
commandDefintion.Flags().VarP(&maxReadAhead, "max-read-ahead", "", "The number of bytes that can be prefetched for sequential reads.")
|
||||
commandDefintion.Flags().IntVarP(&umask, "umask", "", umask, "Override the permission bits set by the filesystem.")
|
||||
commandDefintion.Flags().Uint32VarP(&uid, "uid", "", uid, "Override the uid field set by the filesystem.")
|
||||
commandDefintion.Flags().Uint32VarP(&gid, "gid", "", gid, "Override the gid field set by the filesystem.")
|
||||
//commandDefintion.Flags().BoolVarP(&foreground, "foreground", "", foreground, "Do not detach.")
|
||||
mountlib.NewMountCommand("mount", Mount)
|
||||
}
|
||||
|
||||
var commandDefintion = &cobra.Command{
|
||||
Use: "mount remote:path /path/to/mountpoint",
|
||||
Short: `Mount the remote as a mountpoint. **EXPERIMENTAL**`,
|
||||
Long: `
|
||||
rclone mount allows Linux, FreeBSD and macOS to mount any of Rclone's
|
||||
cloud storage systems as a file system with FUSE.
|
||||
// mountOptions configures the options from the command line flags
|
||||
func mountOptions(device string) (options []fuse.MountOption) {
|
||||
options = []fuse.MountOption{
|
||||
fuse.MaxReadahead(uint32(mountlib.MaxReadAhead)),
|
||||
fuse.Subtype("rclone"),
|
||||
fuse.FSName(device), fuse.VolumeName(device),
|
||||
fuse.NoAppleDouble(),
|
||||
fuse.NoAppleXattr(),
|
||||
|
||||
This is **EXPERIMENTAL** - use with care.
|
||||
// Options from benchmarking in the fuse module
|
||||
//fuse.MaxReadahead(64 * 1024 * 1024),
|
||||
//fuse.AsyncRead(), - FIXME this causes
|
||||
// ReadFileHandle.Read error: read /home/files/ISOs/xubuntu-15.10-desktop-amd64.iso: bad file descriptor
|
||||
// which is probably related to errors people are having
|
||||
//fuse.WritebackCache(),
|
||||
}
|
||||
if mountlib.AllowNonEmpty {
|
||||
options = append(options, fuse.AllowNonEmptyMount())
|
||||
}
|
||||
if mountlib.AllowOther {
|
||||
options = append(options, fuse.AllowOther())
|
||||
}
|
||||
if mountlib.AllowRoot {
|
||||
options = append(options, fuse.AllowRoot())
|
||||
}
|
||||
if mountlib.DefaultPermissions {
|
||||
options = append(options, fuse.DefaultPermissions())
|
||||
}
|
||||
if mountlib.ReadOnly {
|
||||
options = append(options, fuse.ReadOnly())
|
||||
}
|
||||
if mountlib.WritebackCache {
|
||||
options = append(options, fuse.WritebackCache())
|
||||
}
|
||||
if len(*mountlib.ExtraOptions) > 0 {
|
||||
fs.Errorf(nil, "-o/--option not supported with this FUSE backend")
|
||||
}
|
||||
if len(*mountlib.ExtraOptions) > 0 {
|
||||
fs.Errorf(nil, "--fuse-flag not supported with this FUSE backend")
|
||||
}
|
||||
return options
|
||||
}
|
||||
|
||||
First set up your remote using ` + "`rclone config`" + `. Check it works with ` + "`rclone ls`" + ` etc.
|
||||
// mount the file system
|
||||
//
|
||||
// The mount point will be ready when this returns.
|
||||
//
|
||||
// returns an error, and an error channel for the serve process to
|
||||
// report an error when fusermount is called.
|
||||
func mount(f fs.Fs, mountpoint string) (*mountlib.FS, <-chan error, func() error, error) {
|
||||
fs.Debugf(f, "Mounting on %q", mountpoint)
|
||||
c, err := fuse.Mount(mountpoint, mountOptions(f.Name()+":"+f.Root())...)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
Start the mount like this (note the & on the end to put rclone in the background).
|
||||
filesys := NewFS(f)
|
||||
server := fusefs.New(c, nil)
|
||||
|
||||
rclone mount remote:path/to/files /path/to/local/mount &
|
||||
|
||||
Stop the mount with
|
||||
|
||||
fusermount -u /path/to/local/mount
|
||||
|
||||
Or if that fails try
|
||||
|
||||
fusermount -z -u /path/to/local/mount
|
||||
|
||||
Or with OS X
|
||||
|
||||
umount /path/to/local/mount
|
||||
|
||||
### Limitations ###
|
||||
|
||||
This can only write files seqentially, it can only seek when reading.
|
||||
This means that many applications won't work with their files on an
|
||||
rclone mount.
|
||||
|
||||
The bucket based remotes (eg Swift, S3, Google Compute Storage, B2,
|
||||
Hubic) won't work from the root - you will need to specify a bucket,
|
||||
or a path within the bucket. So ` + "`swift:`" + ` won't work whereas
|
||||
` + "`swift:bucket`" + ` will as will ` + "`swift:bucket/path`" + `.
|
||||
None of these support the concept of directories, so empty
|
||||
directories will have a tendency to disappear once they fall out of
|
||||
the directory cache.
|
||||
|
||||
Only supported on Linux, FreeBSD and OS X at the moment.
|
||||
|
||||
### rclone mount vs rclone sync/copy ##
|
||||
|
||||
File systems expect things to be 100% reliable, whereas cloud storage
|
||||
systems are a long way from 100% reliable. The rclone sync/copy
|
||||
commands cope with this with lots of retries. However rclone mount
|
||||
can't use retries in the same way without making local copies of the
|
||||
uploads. This might happen in the future, but for the moment rclone
|
||||
mount won't do that, so will be less reliable than the rclone command.
|
||||
|
||||
### Filters ###
|
||||
|
||||
Note that all the rclone filters can be used to select a subset of the
|
||||
files to be visible in the mount.
|
||||
|
||||
### Bugs ###
|
||||
|
||||
* All the remotes should work for read, but some may not for write
|
||||
* those which need to know the size in advance won't - eg B2
|
||||
* maybe should pass in size as -1 to mean work it out
|
||||
* Or put in an an upload cache to cache the files on disk first
|
||||
|
||||
### TODO ###
|
||||
|
||||
* Check hashes on upload/download
|
||||
* Preserve timestamps
|
||||
* Move directories
|
||||
`,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(2, 2, command, args)
|
||||
fdst := cmd.NewFsDst(args)
|
||||
err := Mount(fdst, args[1])
|
||||
if err != nil {
|
||||
log.Fatalf("Fatal error: %v", err)
|
||||
// Serve the mount point in the background returning error to errChan
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
err := server.Serve(filesys)
|
||||
closeErr := c.Close()
|
||||
if err == nil {
|
||||
err = closeErr
|
||||
}
|
||||
},
|
||||
errChan <- err
|
||||
}()
|
||||
|
||||
// check if the mount process has an error to report
|
||||
<-c.Ready
|
||||
if err := c.MountError; err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
unmount := func() error {
|
||||
return fuse.Unmount(mountpoint)
|
||||
}
|
||||
|
||||
return filesys.FS, errChan, unmount, nil
|
||||
}
|
||||
|
||||
// Mount mounts the remote at mountpoint.
|
||||
//
|
||||
// If noModTime is set then it
|
||||
func Mount(f fs.Fs, mountpoint string) error {
|
||||
if debugFUSE {
|
||||
if mountlib.DebugFUSE {
|
||||
fuse.Debug = func(msg interface{}) {
|
||||
fs.Debugf("fuse", "%v", msg)
|
||||
}
|
||||
}
|
||||
|
||||
// Set permissions
|
||||
dirPerms = 0777 &^ os.FileMode(umask)
|
||||
filePerms = 0666 &^ os.FileMode(umask)
|
||||
|
||||
// Show stats if the user has specifically requested them
|
||||
if cmd.ShowStats() {
|
||||
stopStats := cmd.StartStats()
|
||||
defer close(stopStats)
|
||||
}
|
||||
|
||||
// Mount it
|
||||
errChan, err := mount(f, mountpoint)
|
||||
FS, errChan, unmount, err := mount(f, mountpoint)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to mount FUSE fs")
|
||||
}
|
||||
|
||||
// Wait for umount
|
||||
err = <-errChan
|
||||
sigInt := make(chan os.Signal, 1)
|
||||
signal.Notify(sigInt, syscall.SIGINT, syscall.SIGTERM)
|
||||
sigHup := make(chan os.Signal, 1)
|
||||
signal.Notify(sigHup, syscall.SIGHUP)
|
||||
|
||||
waitloop:
|
||||
for {
|
||||
select {
|
||||
// umount triggered outside the app
|
||||
case err = <-errChan:
|
||||
break waitloop
|
||||
// Program abort: umount
|
||||
case <-sigInt:
|
||||
err = unmount()
|
||||
break waitloop
|
||||
// user sent SIGHUP to clear the cache
|
||||
case <-sigHup:
|
||||
root, err := FS.Root()
|
||||
if err != nil {
|
||||
fs.Errorf(f, "Error reading root: %v", err)
|
||||
} else {
|
||||
root.ForgetAll()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to umount FUSE fs")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package mount
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ncw/rclone/cmd/mountlib/mounttest"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) { mounttest.TestMain(m, mount) }
|
||||
func TestDirLs(t *testing.T) { mounttest.TestDirLs(t) }
|
||||
func TestDirCreateAndRemoveDir(t *testing.T) { mounttest.TestDirCreateAndRemoveDir(t) }
|
||||
func TestDirCreateAndRemoveFile(t *testing.T) { mounttest.TestDirCreateAndRemoveFile(t) }
|
||||
func TestDirRenameFile(t *testing.T) { mounttest.TestDirRenameFile(t) }
|
||||
func TestDirRenameEmptyDir(t *testing.T) { mounttest.TestDirRenameEmptyDir(t) }
|
||||
func TestDirRenameFullDir(t *testing.T) { mounttest.TestDirRenameFullDir(t) }
|
||||
func TestDirModTime(t *testing.T) { mounttest.TestDirModTime(t) }
|
||||
func TestDirCacheFlush(t *testing.T) { mounttest.TestDirCacheFlush(t) }
|
||||
func TestDirCacheFlushOnDirRename(t *testing.T) { mounttest.TestDirCacheFlushOnDirRename(t) }
|
||||
func TestFileModTime(t *testing.T) { mounttest.TestFileModTime(t) }
|
||||
func TestFileModTimeWithOpenWriters(t *testing.T) { mounttest.TestFileModTimeWithOpenWriters(t) }
|
||||
func TestMount(t *testing.T) { mounttest.TestMount(t) }
|
||||
func TestRoot(t *testing.T) { mounttest.TestRoot(t) }
|
||||
func TestReadByByte(t *testing.T) { mounttest.TestReadByByte(t) }
|
||||
func TestReadChecksum(t *testing.T) { mounttest.TestReadChecksum(t) }
|
||||
func TestReadFileDoubleClose(t *testing.T) { mounttest.TestReadFileDoubleClose(t) }
|
||||
func TestReadSeek(t *testing.T) { mounttest.TestReadSeek(t) }
|
||||
func TestWriteFileNoWrite(t *testing.T) { mounttest.TestWriteFileNoWrite(t) }
|
||||
func TestWriteFileWrite(t *testing.T) { mounttest.TestWriteFileWrite(t) }
|
||||
func TestWriteFileOverwrite(t *testing.T) { mounttest.TestWriteFileOverwrite(t) }
|
||||
func TestWriteFileDoubleClose(t *testing.T) { mounttest.TestWriteFileDoubleClose(t) }
|
||||
func TestWriteFileFsync(t *testing.T) { mounttest.TestWriteFileFsync(t) }
|
||||
+21
-172
@@ -3,36 +3,22 @@
|
||||
package mount
|
||||
|
||||
import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"bazil.org/fuse"
|
||||
fusefs "bazil.org/fuse/fs"
|
||||
"github.com/ncw/rclone/cmd/mountlib"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// ReadFileHandle is an open for read file handle on a File
|
||||
type ReadFileHandle struct {
|
||||
mu sync.Mutex
|
||||
closed bool // set if handle has been closed
|
||||
r *fs.Account
|
||||
o fs.Object
|
||||
readCalled bool // set if read has been called
|
||||
offset int64
|
||||
}
|
||||
|
||||
func newReadFileHandle(o fs.Object) (*ReadFileHandle, error) {
|
||||
r, err := o.Open()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fh := &ReadFileHandle{
|
||||
o: o,
|
||||
r: fs.NewAccount(r, o).WithBuffer(), // account the transfer
|
||||
}
|
||||
fs.Stats.Transferring(fh.o.Remote())
|
||||
return fh, nil
|
||||
*mountlib.ReadFileHandle
|
||||
// mu sync.Mutex
|
||||
// closed bool // set if handle has been closed
|
||||
// r *fs.Account
|
||||
// o fs.Object
|
||||
// readCalled bool // set if read has been called
|
||||
// offset int64
|
||||
}
|
||||
|
||||
// Check interface satisfied
|
||||
@@ -41,121 +27,17 @@ var _ fusefs.Handle = (*ReadFileHandle)(nil)
|
||||
// Check interface satisfied
|
||||
var _ fusefs.HandleReader = (*ReadFileHandle)(nil)
|
||||
|
||||
// seek to a new offset
|
||||
//
|
||||
// if reopen is true, then we won't attempt to use an io.Seeker interface
|
||||
//
|
||||
// Must be called with fh.mu held
|
||||
func (fh *ReadFileHandle) seek(offset int64, reopen bool) (err error) {
|
||||
fh.r.StopBuffering() // stop the background reading first
|
||||
oldReader := fh.r.GetReader()
|
||||
r := oldReader
|
||||
// Can we seek it directly?
|
||||
if do, ok := oldReader.(io.Seeker); !reopen && ok {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.seek from %d to %d (io.Seeker)", fh.offset, offset)
|
||||
_, err = do.Seek(offset, 0)
|
||||
if err != nil {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Read io.Seeker failed: %v", err)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.seek from %d to %d", fh.offset, offset)
|
||||
// close old one
|
||||
err = oldReader.Close()
|
||||
if err != nil {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Read seek close old failed: %v", err)
|
||||
}
|
||||
// re-open with a seek
|
||||
r, err = fh.o.Open(&fs.SeekOption{Offset: offset})
|
||||
if err != nil {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Read seek failed: %v", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
fh.r.UpdateReader(r)
|
||||
fh.offset = offset
|
||||
return nil
|
||||
}
|
||||
|
||||
// Read from the file handle
|
||||
func (fh *ReadFileHandle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) (err error) {
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Read size %d offset %d", req.Size, req.Offset)
|
||||
if fh.closed {
|
||||
fs.Errorf(fh.o, "ReadFileHandle.Read error: %v", errClosedFileHandle)
|
||||
return errClosedFileHandle
|
||||
}
|
||||
doSeek := req.Offset != fh.offset
|
||||
var n int
|
||||
var newOffset int64
|
||||
retries := 0
|
||||
buf := make([]byte, req.Size)
|
||||
doReopen := false
|
||||
for {
|
||||
if doSeek {
|
||||
// Are we attempting to seek beyond the end of the
|
||||
// file - if so just return EOF leaving the underlying
|
||||
// file in an unchanged state.
|
||||
if req.Offset >= fh.o.Size() {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Read attempt to read beyond end of file: %d > %d", req.Offset, fh.o.Size())
|
||||
resp.Data = nil
|
||||
return nil
|
||||
}
|
||||
// Otherwise do the seek
|
||||
err = fh.seek(req.Offset, doReopen)
|
||||
} else {
|
||||
err = nil
|
||||
}
|
||||
if err == nil {
|
||||
if req.Size > 0 {
|
||||
fh.readCalled = true
|
||||
}
|
||||
// One exception to the above is if we fail to fully populate a
|
||||
// page cache page; a read into page cache is always page aligned.
|
||||
// Make sure we never serve a partial read, to avoid that.
|
||||
n, err = io.ReadFull(fh.r, buf)
|
||||
newOffset = fh.offset + int64(n)
|
||||
// if err == nil && rand.Intn(10) == 0 {
|
||||
// err = errors.New("random error")
|
||||
// }
|
||||
if err == nil {
|
||||
break
|
||||
} else if (err == io.ErrUnexpectedEOF || err == io.EOF) && newOffset == fh.o.Size() {
|
||||
// Have read to end of file - reset error
|
||||
err = nil
|
||||
break
|
||||
}
|
||||
}
|
||||
if retries >= fs.Config.LowLevelRetries {
|
||||
break
|
||||
}
|
||||
retries++
|
||||
fs.Errorf(fh.o, "ReadFileHandle.Read error: low level retry %d/%d: %v", retries, fs.Config.LowLevelRetries, err)
|
||||
doSeek = true
|
||||
doReopen = true
|
||||
}
|
||||
dataRead := -1
|
||||
defer fs.Trace(fh, "len=%d, offset=%d", req.Size, req.Offset)("read=%d, err=%v", &dataRead, &err)
|
||||
data, err := fh.ReadFileHandle.Read(int64(req.Size), req.Offset)
|
||||
if err != nil {
|
||||
fs.Errorf(fh.o, "ReadFileHandle.Read error: %v", err)
|
||||
} else {
|
||||
resp.Data = buf[:n]
|
||||
fh.offset = newOffset
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Read OK")
|
||||
return translateError(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// close the file handle returning errClosedFileHandle if it has been
|
||||
// closed already.
|
||||
//
|
||||
// Must be called with fh.mu held
|
||||
func (fh *ReadFileHandle) close() error {
|
||||
if fh.closed {
|
||||
return errClosedFileHandle
|
||||
}
|
||||
fh.closed = true
|
||||
fs.Stats.DoneTransferring(fh.o.Remote(), true)
|
||||
return fh.r.Close()
|
||||
resp.Data = data
|
||||
dataRead = len(data)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check interface satisfied
|
||||
@@ -164,30 +46,9 @@ var _ fusefs.HandleFlusher = (*ReadFileHandle)(nil)
|
||||
// Flush is called each time the file or directory is closed.
|
||||
// Because there can be multiple file descriptors referring to a
|
||||
// single opened file, Flush can be called multiple times.
|
||||
func (fh *ReadFileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Flush")
|
||||
|
||||
// Ignore the Flush as there is nothing we can sensibly do and
|
||||
// it seems quite common for Flush to be called from
|
||||
// different threads each of which have read some data.
|
||||
if false {
|
||||
// If Read hasn't been called then ignore the Flush - Release
|
||||
// will pick it up
|
||||
if !fh.readCalled {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Flush ignoring flush on unread handle")
|
||||
return nil
|
||||
|
||||
}
|
||||
err := fh.close()
|
||||
if err != nil {
|
||||
fs.Errorf(fh.o, "ReadFileHandle.Flush error: %v", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Flush OK")
|
||||
return nil
|
||||
func (fh *ReadFileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) (err error) {
|
||||
defer fs.Trace(fh, "")("err=%v", &err)
|
||||
return translateError(fh.ReadFileHandle.Flush())
|
||||
}
|
||||
|
||||
var _ fusefs.HandleReleaser = (*ReadFileHandle)(nil)
|
||||
@@ -196,19 +57,7 @@ var _ fusefs.HandleReleaser = (*ReadFileHandle)(nil)
|
||||
//
|
||||
// It isn't called directly from userspace so the error is ignored by
|
||||
// the kernel
|
||||
func (fh *ReadFileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) error {
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
if fh.closed {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Release nothing to do")
|
||||
return nil
|
||||
}
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Release closing")
|
||||
err := fh.close()
|
||||
if err != nil {
|
||||
fs.Errorf(fh.o, "ReadFileHandle.Release error: %v", err)
|
||||
} else {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Release OK")
|
||||
}
|
||||
return err
|
||||
func (fh *ReadFileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error) {
|
||||
defer fs.Trace(fh, "")("err=%v", &err)
|
||||
return translateError(fh.ReadFileHandle.Release())
|
||||
}
|
||||
+13
-105
@@ -4,11 +4,10 @@ package mount
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"bazil.org/fuse"
|
||||
fusefs "bazil.org/fuse/fs"
|
||||
"github.com/ncw/rclone/cmd/mountlib"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
@@ -17,90 +16,26 @@ var errClosedFileHandle = errors.New("Attempt to use closed file handle")
|
||||
|
||||
// WriteFileHandle is an open for write handle on a File
|
||||
type WriteFileHandle struct {
|
||||
mu sync.Mutex
|
||||
closed bool // set if handle has been closed
|
||||
remote string
|
||||
pipeReader *io.PipeReader
|
||||
pipeWriter *io.PipeWriter
|
||||
o fs.Object
|
||||
result chan error
|
||||
file *File
|
||||
writeCalled bool // set the first time Write() is called
|
||||
*mountlib.WriteFileHandle
|
||||
}
|
||||
|
||||
// Check interface satisfied
|
||||
var _ fusefs.Handle = (*WriteFileHandle)(nil)
|
||||
|
||||
func newWriteFileHandle(d *Dir, f *File, src fs.ObjectInfo) (*WriteFileHandle, error) {
|
||||
fh := &WriteFileHandle{
|
||||
remote: src.Remote(),
|
||||
result: make(chan error, 1),
|
||||
file: f,
|
||||
}
|
||||
fh.pipeReader, fh.pipeWriter = io.Pipe()
|
||||
r := fs.NewAccountSizeName(fh.pipeReader, 0, src.Remote()).WithBuffer() // account the transfer
|
||||
go func() {
|
||||
o, err := d.f.Put(r, src)
|
||||
fh.o = o
|
||||
fh.result <- err
|
||||
}()
|
||||
fh.file.addWriters(1)
|
||||
fs.Stats.Transferring(fh.remote)
|
||||
return fh, nil
|
||||
}
|
||||
|
||||
// Check interface satisfied
|
||||
var _ fusefs.HandleWriter = (*WriteFileHandle)(nil)
|
||||
|
||||
// Write data to the file handle
|
||||
func (fh *WriteFileHandle) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error {
|
||||
fs.Debugf(fh.remote, "WriteFileHandle.Write len=%d", len(req.Data))
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
if fh.closed {
|
||||
fs.Errorf(fh.remote, "WriteFileHandle.Write error: %v", errClosedFileHandle)
|
||||
return errClosedFileHandle
|
||||
}
|
||||
fh.writeCalled = true
|
||||
// FIXME should probably check the file isn't being seeked?
|
||||
n, err := fh.pipeWriter.Write(req.Data)
|
||||
resp.Size = n
|
||||
fh.file.written(int64(n))
|
||||
func (fh *WriteFileHandle) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) (err error) {
|
||||
defer fs.Trace(fh, "len=%d, offset=%d", len(req.Data), req.Offset)("written=%d, err=%v", &resp.Size, &err)
|
||||
n, err := fh.WriteFileHandle.Write(req.Data, req.Offset)
|
||||
if err != nil {
|
||||
fs.Errorf(fh.remote, "WriteFileHandle.Write error: %v", err)
|
||||
return err
|
||||
return translateError(err)
|
||||
}
|
||||
fs.Debugf(fh.remote, "WriteFileHandle.Write OK (%d bytes written)", n)
|
||||
resp.Size = int(n)
|
||||
return nil
|
||||
}
|
||||
|
||||
// close the file handle returning errClosedFileHandle if it has been
|
||||
// closed already.
|
||||
//
|
||||
// Must be called with fh.mu held
|
||||
func (fh *WriteFileHandle) close() error {
|
||||
if fh.closed {
|
||||
return errClosedFileHandle
|
||||
}
|
||||
fh.closed = true
|
||||
fs.Stats.DoneTransferring(fh.remote, true)
|
||||
fh.file.addWriters(-1)
|
||||
writeCloseErr := fh.pipeWriter.Close()
|
||||
err := <-fh.result
|
||||
readCloseErr := fh.pipeReader.Close()
|
||||
if err == nil {
|
||||
fh.file.setObject(fh.o)
|
||||
err = writeCloseErr
|
||||
}
|
||||
if err == nil {
|
||||
err = readCloseErr
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// Check interface satisfied
|
||||
var _ fusefs.HandleFlusher = (*WriteFileHandle)(nil)
|
||||
|
||||
// Flush is called on each close() of a file descriptor. So if a
|
||||
// filesystem wants to return write errors in close() and the file has
|
||||
// cached dirty data, this is a good place to write back data and
|
||||
@@ -116,24 +51,9 @@ var _ fusefs.HandleFlusher = (*WriteFileHandle)(nil)
|
||||
//
|
||||
// Filesystems shouldn't assume that flush will always be called after
|
||||
// some writes, or that if will be called at all.
|
||||
func (fh *WriteFileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
fs.Debugf(fh.remote, "WriteFileHandle.Flush")
|
||||
// If Write hasn't been called then ignore the Flush - Release
|
||||
// will pick it up
|
||||
if !fh.writeCalled {
|
||||
fs.Debugf(fh.remote, "WriteFileHandle.Flush ignoring flush on unwritten handle")
|
||||
return nil
|
||||
|
||||
}
|
||||
err := fh.close()
|
||||
if err != nil {
|
||||
fs.Errorf(fh.remote, "WriteFileHandle.Flush error: %v", err)
|
||||
} else {
|
||||
fs.Debugf(fh.remote, "WriteFileHandle.Flush OK")
|
||||
}
|
||||
return err
|
||||
func (fh *WriteFileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) (err error) {
|
||||
defer fs.Trace(fh, "")("err=%v", &err)
|
||||
return translateError(fh.WriteFileHandle.Flush())
|
||||
}
|
||||
|
||||
var _ fusefs.HandleReleaser = (*WriteFileHandle)(nil)
|
||||
@@ -142,19 +62,7 @@ var _ fusefs.HandleReleaser = (*WriteFileHandle)(nil)
|
||||
//
|
||||
// It isn't called directly from userspace so the error is ignored by
|
||||
// the kernel
|
||||
func (fh *WriteFileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) error {
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
if fh.closed {
|
||||
fs.Debugf(fh.remote, "WriteFileHandle.Release nothing to do")
|
||||
return nil
|
||||
}
|
||||
fs.Debugf(fh.remote, "WriteFileHandle.Release closing")
|
||||
err := fh.close()
|
||||
if err != nil {
|
||||
fs.Errorf(fh.remote, "WriteFileHandle.Release error: %v", err)
|
||||
} else {
|
||||
fs.Debugf(fh.remote, "WriteFileHandle.Release OK")
|
||||
}
|
||||
return err
|
||||
func (fh *WriteFileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error) {
|
||||
defer fs.Trace(fh, "")("err=%v", &err)
|
||||
return translateError(fh.WriteFileHandle.Release())
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package mount
|
||||
package mountlib
|
||||
|
||||
import (
|
||||
"time"
|
||||
@@ -0,0 +1,486 @@
|
||||
package mountlib
|
||||
|
||||
import (
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// DirEntry describes the contents of a directory entry
|
||||
//
|
||||
// It can be a file or a directory
|
||||
//
|
||||
// node may be nil, but o may not
|
||||
type DirEntry struct {
|
||||
Obj fs.DirEntry
|
||||
Node Node
|
||||
}
|
||||
|
||||
// Dir represents a directory entry
|
||||
type Dir struct {
|
||||
fsys *FS
|
||||
inode uint64 // inode number
|
||||
f fs.Fs
|
||||
path string
|
||||
modTime time.Time
|
||||
mu sync.Mutex // protects the following
|
||||
read time.Time // time directory entry last read
|
||||
items map[string]*DirEntry // NB can be nil when directory not read yet
|
||||
}
|
||||
|
||||
func newDir(fsys *FS, f fs.Fs, fsDir fs.Directory) *Dir {
|
||||
return &Dir{
|
||||
fsys: fsys,
|
||||
f: f,
|
||||
path: fsDir.Remote(),
|
||||
modTime: fsDir.ModTime(),
|
||||
inode: NewInode(),
|
||||
}
|
||||
}
|
||||
|
||||
// String converts it to printablee
|
||||
func (d *Dir) String() string {
|
||||
if d == nil {
|
||||
return "<nil *Dir>"
|
||||
}
|
||||
return d.path + "/"
|
||||
}
|
||||
|
||||
// IsFile returns false for Dir - satisfies Node interface
|
||||
func (d *Dir) IsFile() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Inode returns the inode number - satisfies Node interface
|
||||
func (d *Dir) Inode() uint64 {
|
||||
return d.inode
|
||||
}
|
||||
|
||||
// Node returns the Node assocuated with this - satisfies Noder interface
|
||||
func (d *Dir) Node() Node {
|
||||
return d
|
||||
}
|
||||
|
||||
// ForgetAll ensures the directory and all its children are purged
|
||||
// from the cache.
|
||||
func (d *Dir) ForgetAll() {
|
||||
d.ForgetPath("")
|
||||
}
|
||||
|
||||
// ForgetPath clears the cache for itself and all subdirectories if
|
||||
// they match the given path. The path is specified relative from the
|
||||
// directory it is called from.
|
||||
// It is not possible to traverse the directory tree upwards, i.e.
|
||||
// you cannot clear the cache for the Dir's ancestors or siblings.
|
||||
func (d *Dir) ForgetPath(relativePath string) {
|
||||
absPath := path.Join(d.path, relativePath)
|
||||
if absPath == "." {
|
||||
absPath = ""
|
||||
}
|
||||
|
||||
d.walk(absPath, func(dir *Dir) {
|
||||
fs.Debugf(dir.path, "forgetting directory cache")
|
||||
dir.read = time.Time{}
|
||||
dir.items = nil
|
||||
})
|
||||
}
|
||||
|
||||
// walk runs a function on all directories whose path matches
|
||||
// the given absolute one. It will be called on a directory's
|
||||
// children first. It will not apply the function to parent
|
||||
// nodes, regardless of the given path.
|
||||
func (d *Dir) walk(absPath string, fun func(*Dir)) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
if d.items != nil {
|
||||
for _, entry := range d.items {
|
||||
if dir, ok := entry.Node.(*Dir); ok {
|
||||
dir.walk(absPath, fun)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if d.path == absPath || absPath == "" || strings.HasPrefix(d.path, absPath+"/") {
|
||||
fun(d)
|
||||
}
|
||||
}
|
||||
|
||||
// rename should be called after the directory is renamed
|
||||
//
|
||||
// Reset the directory to new state, discarding all the objects and
|
||||
// reading everything again
|
||||
func (d *Dir) rename(newParent *Dir, fsDir fs.Directory) {
|
||||
d.ForgetAll()
|
||||
d.path = fsDir.Remote()
|
||||
d.modTime = fsDir.ModTime()
|
||||
d.read = time.Time{}
|
||||
}
|
||||
|
||||
// addObject adds a new object or directory to the directory
|
||||
//
|
||||
// note that we add new objects rather than updating old ones
|
||||
func (d *Dir) addObject(o fs.DirEntry, node Node) *DirEntry {
|
||||
item := &DirEntry{
|
||||
Obj: o,
|
||||
Node: node,
|
||||
}
|
||||
d.mu.Lock()
|
||||
if d.items != nil {
|
||||
d.items[path.Base(o.Remote())] = item
|
||||
}
|
||||
d.mu.Unlock()
|
||||
return item
|
||||
}
|
||||
|
||||
// delObject removes an object from the directory
|
||||
func (d *Dir) delObject(leaf string) {
|
||||
d.mu.Lock()
|
||||
if d.items != nil {
|
||||
delete(d.items, leaf)
|
||||
}
|
||||
d.mu.Unlock()
|
||||
}
|
||||
|
||||
// read the directory and sets d.items - must be called with the lock held
|
||||
func (d *Dir) _readDir() error {
|
||||
when := time.Now()
|
||||
if d.read.IsZero() || d.items == nil {
|
||||
// fs.Debugf(d.path, "Reading directory")
|
||||
} else {
|
||||
age := when.Sub(d.read)
|
||||
if age < d.fsys.dirCacheTime {
|
||||
return nil
|
||||
}
|
||||
fs.Debugf(d.path, "Re-reading directory (%v old)", age)
|
||||
}
|
||||
entries, err := fs.ListDirSorted(d.f, false, d.path)
|
||||
if err == fs.ErrorDirNotFound {
|
||||
// We treat directory not found as empty because we
|
||||
// create directories on the fly
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
// NB when we re-read a directory after its cache has expired
|
||||
// we drop the old files which should lead to correct
|
||||
// behaviour but may not be very efficient.
|
||||
|
||||
// Keep a note of the previous contents of the directory
|
||||
oldItems := d.items
|
||||
|
||||
// Cache the items by name
|
||||
d.items = make(map[string]*DirEntry, len(entries))
|
||||
for _, entry := range entries {
|
||||
switch item := entry.(type) {
|
||||
case fs.Object:
|
||||
obj := item
|
||||
name := path.Base(obj.Remote())
|
||||
d.items[name] = &DirEntry{
|
||||
Obj: obj,
|
||||
Node: nil,
|
||||
}
|
||||
case fs.Directory:
|
||||
dir := item
|
||||
name := path.Base(dir.Remote())
|
||||
// Use old dir value if it exists
|
||||
if oldItems != nil {
|
||||
if oldItem, ok := oldItems[name]; ok {
|
||||
if _, ok := oldItem.Obj.(fs.Directory); ok {
|
||||
d.items[name] = oldItem
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
d.items[name] = &DirEntry{
|
||||
Obj: dir,
|
||||
Node: nil,
|
||||
}
|
||||
default:
|
||||
err = errors.Errorf("unknown type %T", item)
|
||||
fs.Errorf(d.path, "readDir error: %v", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
d.read = when
|
||||
return nil
|
||||
}
|
||||
|
||||
// lookup a single item in the directory
|
||||
//
|
||||
// returns ENOENT if not found.
|
||||
func (d *Dir) lookup(leaf string) (*DirEntry, error) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
err := d._readDir()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
item, ok := d.items[leaf]
|
||||
if !ok {
|
||||
return nil, ENOENT
|
||||
}
|
||||
return item, nil
|
||||
}
|
||||
|
||||
// Check to see if a directory is empty
|
||||
func (d *Dir) isEmpty() (bool, error) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
err := d._readDir()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return len(d.items) == 0, nil
|
||||
}
|
||||
|
||||
// ModTime returns the modification time of the directory
|
||||
func (d *Dir) ModTime() time.Time {
|
||||
// fs.Debugf(d.path, "Dir.ModTime %v", d.modTime)
|
||||
return d.modTime
|
||||
}
|
||||
|
||||
// SetModTime sets the modTime for this dir
|
||||
func (d *Dir) SetModTime(modTime time.Time) error {
|
||||
if d.fsys.readOnly {
|
||||
return EROFS
|
||||
}
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
d.modTime = modTime
|
||||
return nil
|
||||
}
|
||||
|
||||
// lookupNode calls lookup then makes sure the node is not nil in the DirEntry
|
||||
func (d *Dir) lookupNode(leaf string) (item *DirEntry, err error) {
|
||||
item, err = d.lookup(leaf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if item.Node != nil {
|
||||
return item, nil
|
||||
}
|
||||
var node Node
|
||||
switch x := item.Obj.(type) {
|
||||
case fs.Object:
|
||||
node, err = newFile(d, x, leaf), nil
|
||||
case fs.Directory:
|
||||
node, err = newDir(d.fsys, d.f, x), nil
|
||||
default:
|
||||
err = errors.Errorf("unknown type %T", item)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
item = d.addObject(item.Obj, node)
|
||||
return item, nil
|
||||
}
|
||||
|
||||
// Lookup looks up a specific entry in the receiver.
|
||||
//
|
||||
// Lookup should return a Node corresponding to the entry. If the
|
||||
// name does not exist in the directory, Lookup should return ENOENT.
|
||||
//
|
||||
// Lookup need not to handle the names "." and "..".
|
||||
func (d *Dir) Lookup(name string) (node Node, err error) {
|
||||
path := path.Join(d.path, name)
|
||||
// fs.Debugf(path, "Dir.Lookup")
|
||||
item, err := d.lookupNode(name)
|
||||
if err != nil {
|
||||
if err != ENOENT {
|
||||
fs.Errorf(path, "Dir.Lookup error: %v", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
// fs.Debugf(path, "Dir.Lookup OK")
|
||||
return item.Node, nil
|
||||
}
|
||||
|
||||
// ReadDirAll reads the contents of the directory
|
||||
func (d *Dir) ReadDirAll() (items []*DirEntry, err error) {
|
||||
// fs.Debugf(d.path, "Dir.ReadDirAll")
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
err = d._readDir()
|
||||
if err != nil {
|
||||
fs.Debugf(d.path, "Dir.ReadDirAll error: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
for _, item := range d.items {
|
||||
items = append(items, item)
|
||||
}
|
||||
// fs.Debugf(d.path, "Dir.ReadDirAll OK with %d entries", len(items))
|
||||
return items, nil
|
||||
}
|
||||
|
||||
// Create makes a new file
|
||||
func (d *Dir) Create(name string) (*File, *WriteFileHandle, error) {
|
||||
if d.fsys.readOnly {
|
||||
return nil, nil, EROFS
|
||||
}
|
||||
path := path.Join(d.path, name)
|
||||
// fs.Debugf(path, "Dir.Create")
|
||||
src := newCreateInfo(d.f, path)
|
||||
// This gets added to the directory when the file is written
|
||||
file := newFile(d, nil, name)
|
||||
fh, err := newWriteFileHandle(d, file, src)
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Create error: %v", err)
|
||||
return nil, nil, err
|
||||
}
|
||||
// fs.Debugf(path, "Dir.Create OK")
|
||||
return file, fh, nil
|
||||
}
|
||||
|
||||
// Mkdir creates a new directory
|
||||
func (d *Dir) Mkdir(name string) (*Dir, error) {
|
||||
if d.fsys.readOnly {
|
||||
return nil, EROFS
|
||||
}
|
||||
path := path.Join(d.path, name)
|
||||
// fs.Debugf(path, "Dir.Mkdir")
|
||||
err := d.f.Mkdir(path)
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Mkdir failed to create directory: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
fsDir := fs.NewDir(path, time.Now())
|
||||
dir := newDir(d.fsys, d.f, fsDir)
|
||||
d.addObject(fsDir, dir)
|
||||
// fs.Debugf(path, "Dir.Mkdir OK")
|
||||
return dir, nil
|
||||
}
|
||||
|
||||
// Remove removes the entry with the given name from
|
||||
// the receiver, which must be a directory. The entry to be removed
|
||||
// may correspond to a file (unlink) or to a directory (rmdir).
|
||||
func (d *Dir) Remove(name string) error {
|
||||
if d.fsys.readOnly {
|
||||
return EROFS
|
||||
}
|
||||
path := path.Join(d.path, name)
|
||||
// fs.Debugf(path, "Dir.Remove")
|
||||
item, err := d.lookupNode(name)
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Remove error: %v", err)
|
||||
return err
|
||||
}
|
||||
switch x := item.Obj.(type) {
|
||||
case fs.Object:
|
||||
err = x.Remove()
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Remove file error: %v", err)
|
||||
return err
|
||||
}
|
||||
case fs.Directory:
|
||||
// Check directory is empty first
|
||||
dir := item.Node.(*Dir)
|
||||
empty, err := dir.isEmpty()
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Remove dir error: %v", err)
|
||||
return err
|
||||
}
|
||||
if !empty {
|
||||
fs.Errorf(path, "Dir.Remove not empty")
|
||||
return ENOTEMPTY
|
||||
}
|
||||
// remove directory
|
||||
err = d.f.Rmdir(path)
|
||||
if err != nil {
|
||||
fs.Errorf(path, "Dir.Remove failed to remove directory: %v", err)
|
||||
return err
|
||||
}
|
||||
default:
|
||||
fs.Errorf(path, "Dir.Remove unknown type %T", item)
|
||||
return errors.Errorf("unknown type %T", item)
|
||||
}
|
||||
// Remove the item from the directory listing
|
||||
d.delObject(name)
|
||||
// fs.Debugf(path, "Dir.Remove OK")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Rename the file
|
||||
func (d *Dir) Rename(oldName, newName string, destDir *Dir) error {
|
||||
if d.fsys.readOnly {
|
||||
return EROFS
|
||||
}
|
||||
oldPath := path.Join(d.path, oldName)
|
||||
newPath := path.Join(destDir.path, newName)
|
||||
// fs.Debugf(oldPath, "Dir.Rename to %q", newPath)
|
||||
oldItem, err := d.lookupNode(oldName)
|
||||
if err != nil {
|
||||
fs.Errorf(oldPath, "Dir.Rename error: %v", err)
|
||||
return err
|
||||
}
|
||||
var newObj fs.DirEntry
|
||||
oldNode := oldItem.Node
|
||||
switch x := oldItem.Obj.(type) {
|
||||
case fs.Object:
|
||||
oldObject := x
|
||||
// FIXME: could Copy then Delete if Move not available
|
||||
// - though care needed if case insensitive...
|
||||
doMove := d.f.Features().Move
|
||||
if doMove == nil {
|
||||
err := errors.Errorf("Fs %q can't rename files (no Move)", d.f)
|
||||
fs.Errorf(oldPath, "Dir.Rename error: %v", err)
|
||||
return err
|
||||
}
|
||||
newObject, err := doMove(oldObject, newPath)
|
||||
if err != nil {
|
||||
fs.Errorf(oldPath, "Dir.Rename error: %v", err)
|
||||
return err
|
||||
}
|
||||
newObj = newObject
|
||||
// Update the node with the new details
|
||||
if oldNode != nil {
|
||||
if oldFile, ok := oldNode.(*File); ok {
|
||||
fs.Debugf(oldItem.Obj, "Updating file with %v %p", newObject, oldFile)
|
||||
oldFile.rename(destDir, newObject)
|
||||
}
|
||||
}
|
||||
case fs.Directory:
|
||||
doDirMove := d.f.Features().DirMove
|
||||
if doDirMove == nil {
|
||||
err := errors.Errorf("Fs %q can't rename directories (no DirMove)", d.f)
|
||||
fs.Errorf(oldPath, "Dir.Rename error: %v", err)
|
||||
return err
|
||||
}
|
||||
srcRemote := x.Remote()
|
||||
dstRemote := newPath
|
||||
err = doDirMove(d.f, srcRemote, dstRemote)
|
||||
if err != nil {
|
||||
fs.Errorf(oldPath, "Dir.Rename error: %v", err)
|
||||
return err
|
||||
}
|
||||
newDir := fs.NewDirCopy(x).SetRemote(newPath)
|
||||
newObj = newDir
|
||||
// Update the node with the new details
|
||||
if oldNode != nil {
|
||||
if oldDir, ok := oldNode.(*Dir); ok {
|
||||
fs.Debugf(oldItem.Obj, "Updating dir with %v %p", newDir, oldDir)
|
||||
oldDir.rename(destDir, newDir)
|
||||
}
|
||||
}
|
||||
default:
|
||||
err = errors.Errorf("unknown type %T", oldItem)
|
||||
fs.Errorf(d.path, "Dir.ReadDirAll error: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
// Show moved - delete from old dir and add to new
|
||||
d.delObject(oldName)
|
||||
destDir.addObject(newObj, oldNode)
|
||||
|
||||
// fs.Debugf(newPath, "Dir.Rename renamed from %q", oldPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Fsync the directory
|
||||
//
|
||||
// Note that we don't do anything except return OK
|
||||
func (d *Dir) Fsync() error {
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Cross platform errors
|
||||
|
||||
package mountlib
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Error describes low level errors in a cross platform way
|
||||
type Error byte
|
||||
|
||||
// NB if changing errors translateError in cmd/mount/fs.go, cmd/cmount/fs.go
|
||||
|
||||
// Low level errors
|
||||
const (
|
||||
OK Error = iota
|
||||
ENOENT
|
||||
ENOTEMPTY
|
||||
EEXIST
|
||||
ESPIPE
|
||||
EBADF
|
||||
EROFS
|
||||
)
|
||||
|
||||
var errorNames = []string{
|
||||
OK: "Success",
|
||||
ENOENT: "No such file or directory",
|
||||
ENOTEMPTY: "Directory not empty",
|
||||
EEXIST: "File exists",
|
||||
ESPIPE: "Illegal seek",
|
||||
EBADF: "Bad file descriptor",
|
||||
EROFS: "Read only file system",
|
||||
}
|
||||
|
||||
// Error renders the error as a string
|
||||
func (e Error) Error() string {
|
||||
if int(e) >= len(errorNames) {
|
||||
return fmt.Sprintf("Low level error %d", e)
|
||||
}
|
||||
return errorNames[e]
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
package mountlib
|
||||
|
||||
import (
|
||||
"path"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// File represents a file
|
||||
type File struct {
|
||||
inode uint64 // inode number
|
||||
size int64 // size of file - read and written with atomic int64 - must be 64 bit aligned
|
||||
d *Dir // parent directory - read only
|
||||
mu sync.RWMutex // protects the following
|
||||
o fs.Object // NB o may be nil if file is being written
|
||||
leaf string // leaf name of the object
|
||||
writers int // number of writers for this file
|
||||
pendingModTime time.Time // will be applied once o becomes available, i.e. after file was written
|
||||
}
|
||||
|
||||
// newFile creates a new File
|
||||
func newFile(d *Dir, o fs.Object, leaf string) *File {
|
||||
return &File{
|
||||
d: d,
|
||||
o: o,
|
||||
leaf: leaf,
|
||||
inode: NewInode(),
|
||||
}
|
||||
}
|
||||
|
||||
// String converts it to printable
|
||||
func (f *File) String() string {
|
||||
if f == nil {
|
||||
return "<nil *File>"
|
||||
}
|
||||
return path.Join(f.d.path, f.leaf)
|
||||
}
|
||||
|
||||
// IsFile returns true for File - satisfies Node interface
|
||||
func (f *File) IsFile() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Inode returns the inode number - satisfies Node interface
|
||||
func (f *File) Inode() uint64 {
|
||||
return f.inode
|
||||
}
|
||||
|
||||
// Node returns the Node assocuated with this - satisfies Noder interface
|
||||
func (f *File) Node() Node {
|
||||
return f
|
||||
}
|
||||
|
||||
// rename should be called to update f.o and f.d after a rename
|
||||
func (f *File) rename(d *Dir, o fs.Object) {
|
||||
f.mu.Lock()
|
||||
f.o = o
|
||||
f.d = d
|
||||
f.mu.Unlock()
|
||||
}
|
||||
|
||||
// addWriters increments or decrements the writers
|
||||
func (f *File) addWriters(n int) {
|
||||
f.mu.Lock()
|
||||
f.writers += n
|
||||
f.mu.Unlock()
|
||||
}
|
||||
|
||||
// Attr fills out the attributes for the file
|
||||
func (f *File) Attr(noModTime bool) (modTime time.Time, Size, Blocks uint64, err error) {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
// if o is nil it isn't valid yet or there are writers, so return the size so far
|
||||
if f.o == nil || f.writers != 0 {
|
||||
Size = uint64(atomic.LoadInt64(&f.size))
|
||||
if !noModTime && !f.pendingModTime.IsZero() {
|
||||
modTime = f.pendingModTime
|
||||
}
|
||||
} else {
|
||||
Size = uint64(f.o.Size())
|
||||
if !noModTime {
|
||||
modTime = f.o.ModTime()
|
||||
}
|
||||
}
|
||||
Blocks = (Size + 511) / 512
|
||||
// fs.Debugf(f.o, "File.Attr modTime=%v, Size=%d, Blocks=%v", modTime, Size, Blocks)
|
||||
return
|
||||
}
|
||||
|
||||
// SetModTime sets the modtime for the file
|
||||
func (f *File) SetModTime(modTime time.Time) error {
|
||||
if f.d.fsys.readOnly {
|
||||
return EROFS
|
||||
}
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
|
||||
f.pendingModTime = modTime
|
||||
|
||||
if f.o != nil {
|
||||
return f.applyPendingModTime()
|
||||
}
|
||||
|
||||
// queue up for later, hoping f.o becomes available
|
||||
return nil
|
||||
}
|
||||
|
||||
// call with the mutex held
|
||||
func (f *File) applyPendingModTime() error {
|
||||
defer func() { f.pendingModTime = time.Time{} }()
|
||||
|
||||
if f.pendingModTime.IsZero() {
|
||||
return nil
|
||||
}
|
||||
|
||||
if f.o == nil {
|
||||
return errors.New("Cannot apply ModTime, file object is not available")
|
||||
}
|
||||
|
||||
err := f.o.SetModTime(f.pendingModTime)
|
||||
switch err {
|
||||
case nil:
|
||||
fs.Debugf(f.o, "File.applyPendingModTime OK")
|
||||
case fs.ErrorCantSetModTime, fs.ErrorCantSetModTimeWithoutDelete:
|
||||
// do nothing, in order to not break "touch somefile" if it exists already
|
||||
default:
|
||||
fs.Errorf(f.o, "File.applyPendingModTime error: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Update the size while writing
|
||||
func (f *File) setSize(n int64) {
|
||||
atomic.StoreInt64(&f.size, n)
|
||||
}
|
||||
|
||||
// Update the object when written
|
||||
func (f *File) setObject(o fs.Object) {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
f.o = o
|
||||
_ = f.applyPendingModTime()
|
||||
f.d.addObject(o, f)
|
||||
}
|
||||
|
||||
// Wait for f.o to become non nil for a short time returning it or an
|
||||
// error
|
||||
//
|
||||
// Call without the mutex held
|
||||
func (f *File) waitForValidObject() (o fs.Object, err error) {
|
||||
for i := 0; i < 50; i++ {
|
||||
f.mu.Lock()
|
||||
o = f.o
|
||||
writers := f.writers
|
||||
f.mu.Unlock()
|
||||
if o != nil {
|
||||
return o, nil
|
||||
}
|
||||
if writers == 0 {
|
||||
return nil, errors.New("can't open file - writer failed")
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
return nil, ENOENT
|
||||
}
|
||||
|
||||
// OpenRead open the file for read
|
||||
func (f *File) OpenRead() (fh *ReadFileHandle, err error) {
|
||||
// if o is nil it isn't valid yet
|
||||
o, err := f.waitForValidObject()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// fs.Debugf(o, "File.OpenRead")
|
||||
|
||||
fh, err = newReadFileHandle(f, o)
|
||||
err = errors.Wrap(err, "open for read")
|
||||
|
||||
if err != nil {
|
||||
fs.Errorf(o, "File.OpenRead failed: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
return fh, nil
|
||||
}
|
||||
|
||||
// OpenWrite open the file for write
|
||||
func (f *File) OpenWrite() (fh *WriteFileHandle, err error) {
|
||||
if f.d.fsys.readOnly {
|
||||
return nil, EROFS
|
||||
}
|
||||
// if o is nil it isn't valid yet
|
||||
o, err := f.waitForValidObject()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// fs.Debugf(o, "File.OpenWrite")
|
||||
|
||||
src := newCreateInfo(f.d.f, o.Remote())
|
||||
fh, err = newWriteFileHandle(f.d, f, src)
|
||||
err = errors.Wrap(err, "open for write")
|
||||
|
||||
if err != nil {
|
||||
fs.Errorf(o, "File.OpenWrite failed: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
return fh, nil
|
||||
}
|
||||
|
||||
// Fsync the file
|
||||
//
|
||||
// Note that we don't do anything except return OK
|
||||
func (f *File) Fsync() error {
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package mountlib
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
)
|
||||
|
||||
// Node represents either a *Dir or a *File
|
||||
type Node interface {
|
||||
IsFile() bool
|
||||
Inode() uint64
|
||||
}
|
||||
|
||||
var (
|
||||
_ Node = (*File)(nil)
|
||||
_ Node = (*Dir)(nil)
|
||||
)
|
||||
|
||||
// Noder represents something which can return a node
|
||||
type Noder interface {
|
||||
fmt.Stringer
|
||||
Node() Node
|
||||
}
|
||||
|
||||
var (
|
||||
_ Noder = (*File)(nil)
|
||||
_ Noder = (*Dir)(nil)
|
||||
_ Noder = (*ReadFileHandle)(nil)
|
||||
_ Noder = (*WriteFileHandle)(nil)
|
||||
)
|
||||
|
||||
// FS represents the top level filing system
|
||||
type FS struct {
|
||||
f fs.Fs
|
||||
root *Dir
|
||||
noSeek bool // don't allow seeking if set
|
||||
noChecksum bool // don't check checksums if set
|
||||
readOnly bool // if set FS is read only
|
||||
dirCacheTime time.Duration // how long to consider directory listing cache valid
|
||||
}
|
||||
|
||||
// NewFS creates a new filing system and root directory
|
||||
func NewFS(f fs.Fs) *FS {
|
||||
fsDir := fs.NewDir("", time.Now())
|
||||
fsys := &FS{
|
||||
f: f,
|
||||
}
|
||||
|
||||
if NoSeek {
|
||||
fsys.noSeek = true
|
||||
}
|
||||
if NoChecksum {
|
||||
fsys.noChecksum = true
|
||||
}
|
||||
if ReadOnly {
|
||||
fsys.readOnly = true
|
||||
}
|
||||
fsys.dirCacheTime = DirCacheTime
|
||||
|
||||
fsys.root = newDir(fsys, f, fsDir)
|
||||
|
||||
if PollInterval > 0 {
|
||||
fsys.PollChanges(PollInterval)
|
||||
}
|
||||
return fsys
|
||||
}
|
||||
|
||||
// PollChanges will poll the remote every pollInterval for changes if the remote
|
||||
// supports it. If a non-polling option is used, the given time interval can be
|
||||
// ignored
|
||||
func (fsys *FS) PollChanges(pollInterval time.Duration) *FS {
|
||||
doDirChangeNotify := fsys.f.Features().DirChangeNotify
|
||||
if doDirChangeNotify != nil {
|
||||
doDirChangeNotify(fsys.root.ForgetPath, pollInterval)
|
||||
}
|
||||
return fsys
|
||||
}
|
||||
|
||||
// Root returns the root node
|
||||
func (fsys *FS) Root() (*Dir, error) {
|
||||
// fs.Debugf(fsys.f, "Root()")
|
||||
return fsys.root, nil
|
||||
}
|
||||
|
||||
var inodeCount uint64
|
||||
|
||||
// NewInode creates a new unique inode number
|
||||
func NewInode() (inode uint64) {
|
||||
return atomic.AddUint64(&inodeCount, 1)
|
||||
}
|
||||
|
||||
// Lookup finds the Node by path starting from the root
|
||||
func (fsys *FS) Lookup(path string) (node Node, err error) {
|
||||
node = fsys.root
|
||||
for path != "" {
|
||||
i := strings.IndexRune(path, '/')
|
||||
var name string
|
||||
if i < 0 {
|
||||
name, path = path, ""
|
||||
} else {
|
||||
name, path = path[:i], path[i+1:]
|
||||
}
|
||||
if name == "" {
|
||||
continue
|
||||
}
|
||||
dir, ok := node.(*Dir)
|
||||
if !ok {
|
||||
// We need to look in a directory, but found a file
|
||||
return nil, ENOENT
|
||||
}
|
||||
node, err = dir.Lookup(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Statfs is called to obtain file system metadata.
|
||||
// It should write that data to resp.
|
||||
func (fsys *FS) Statfs() error {
|
||||
/* FIXME
|
||||
const blockSize = 4096
|
||||
const fsBlocks = (1 << 50) / blockSize
|
||||
resp.Blocks = fsBlocks // Total data blocks in file system.
|
||||
resp.Bfree = fsBlocks // Free blocks in file system.
|
||||
resp.Bavail = fsBlocks // Free blocks in file system if you're not root.
|
||||
resp.Files = 1E9 // Total files in file system.
|
||||
resp.Ffree = 1E9 // Free files in file system.
|
||||
resp.Bsize = blockSize // Block size
|
||||
resp.Namelen = 255 // Maximum file name length?
|
||||
resp.Frsize = blockSize // Fragment size, smallest addressable data size in the file system.
|
||||
*/
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package mountlib
|
||||
|
||||
// Globals
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/ncw/rclone/cmd"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// Options set by command line flags
|
||||
var (
|
||||
NoModTime = false
|
||||
NoChecksum = false
|
||||
DebugFUSE = false
|
||||
NoSeek = false
|
||||
DirCacheTime = 5 * 60 * time.Second
|
||||
PollInterval = time.Minute
|
||||
// mount options
|
||||
ReadOnly = false
|
||||
AllowNonEmpty = false
|
||||
AllowRoot = false
|
||||
AllowOther = false
|
||||
DefaultPermissions = false
|
||||
WritebackCache = false
|
||||
MaxReadAhead fs.SizeSuffix = 128 * 1024
|
||||
Umask = 0
|
||||
UID = ^uint32(0) // these values instruct WinFSP-FUSE to use the current user
|
||||
GID = ^uint32(0) // overriden for non windows in mount_unix.go
|
||||
// foreground = false
|
||||
// default permissions for directories - modified by umask in Mount
|
||||
DirPerms = os.FileMode(0777)
|
||||
FilePerms = os.FileMode(0666)
|
||||
ExtraOptions *[]string
|
||||
ExtraFlags *[]string
|
||||
)
|
||||
|
||||
// NewMountCommand makes a mount command with the given name and Mount function
|
||||
func NewMountCommand(commandName string, Mount func(f fs.Fs, mountpoint string) error) *cobra.Command {
|
||||
var commandDefintion = &cobra.Command{
|
||||
Use: commandName + " remote:path /path/to/mountpoint",
|
||||
Short: `Mount the remote as a mountpoint. **EXPERIMENTAL**`,
|
||||
Long: `
|
||||
rclone ` + commandName + ` allows Linux, FreeBSD, macOS and Windows to
|
||||
mount any of Rclone's cloud storage systems as a file system with
|
||||
FUSE.
|
||||
|
||||
This is **EXPERIMENTAL** - use with care.
|
||||
|
||||
First set up your remote using ` + "`rclone config`" + `. Check it works with ` + "`rclone ls`" + ` etc.
|
||||
|
||||
Start the mount like this
|
||||
|
||||
rclone ` + commandName + ` remote:path/to/files /path/to/local/mount
|
||||
|
||||
Or on Windows like this where X: is an unused drive letter
|
||||
|
||||
rclone ` + commandName + ` remote:path/to/files X:
|
||||
|
||||
When the program ends, either via Ctrl+C or receiving a SIGINT or SIGTERM signal,
|
||||
the mount is automatically stopped.
|
||||
|
||||
The umount operation can fail, for example when the mountpoint is busy.
|
||||
When that happens, it is the user's responsibility to stop the mount manually with
|
||||
|
||||
# Linux
|
||||
fusermount -u /path/to/local/mount
|
||||
# OS X
|
||||
umount /path/to/local/mount
|
||||
|
||||
### Limitations ###
|
||||
|
||||
This can only write files seqentially, it can only seek when reading.
|
||||
This means that many applications won't work with their files on an
|
||||
rclone mount.
|
||||
|
||||
The bucket based remotes (eg Swift, S3, Google Compute Storage, B2,
|
||||
Hubic) won't work from the root - you will need to specify a bucket,
|
||||
or a path within the bucket. So ` + "`swift:`" + ` won't work whereas
|
||||
` + "`swift:bucket`" + ` will as will ` + "`swift:bucket/path`" + `.
|
||||
None of these support the concept of directories, so empty
|
||||
directories will have a tendency to disappear once they fall out of
|
||||
the directory cache.
|
||||
|
||||
Only supported on Linux, FreeBSD, OS X and Windows at the moment.
|
||||
|
||||
### rclone ` + commandName + ` vs rclone sync/copy ##
|
||||
|
||||
File systems expect things to be 100% reliable, whereas cloud storage
|
||||
systems are a long way from 100% reliable. The rclone sync/copy
|
||||
commands cope with this with lots of retries. However rclone ` + commandName + `
|
||||
can't use retries in the same way without making local copies of the
|
||||
uploads. This might happen in the future, but for the moment rclone
|
||||
` + commandName + ` won't do that, so will be less reliable than the rclone command.
|
||||
|
||||
### Filters ###
|
||||
|
||||
Note that all the rclone filters can be used to select a subset of the
|
||||
files to be visible in the mount.
|
||||
|
||||
### Directory Cache ###
|
||||
|
||||
Using the ` + "`--dir-cache-time`" + ` flag, you can set how long a
|
||||
directory should be considered up to date and not refreshed from the
|
||||
backend. Changes made locally in the mount may appear immediately or
|
||||
invalidate the cache. However, changes done on the remote will only
|
||||
be picked up once the cache expires.
|
||||
|
||||
Alternatively, you can send a ` + "`SIGHUP`" + ` signal to rclone for
|
||||
it to flush all directory caches, regardless of how old they are.
|
||||
Assuming only one rclone instance is running, you can reset the cache
|
||||
like this:
|
||||
|
||||
kill -SIGHUP $(pidof rclone)
|
||||
|
||||
### Bugs ###
|
||||
|
||||
* All the remotes should work for read, but some may not for write
|
||||
* those which need to know the size in advance won't - eg B2
|
||||
* maybe should pass in size as -1 to mean work it out
|
||||
* Or put in an an upload cache to cache the files on disk first
|
||||
`,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(2, 2, command, args)
|
||||
fdst := cmd.NewFsDst(args)
|
||||
|
||||
// Mask permissions
|
||||
DirPerms = 0777 &^ os.FileMode(Umask)
|
||||
FilePerms = 0666 &^ os.FileMode(Umask)
|
||||
|
||||
// Show stats if the user has specifically requested them
|
||||
if cmd.ShowStats() {
|
||||
stopStats := cmd.StartStats()
|
||||
defer close(stopStats)
|
||||
}
|
||||
|
||||
err := Mount(fdst, args[1])
|
||||
if err != nil {
|
||||
log.Fatalf("Fatal error: %v", err)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// Register the command
|
||||
cmd.Root.AddCommand(commandDefintion)
|
||||
|
||||
// Add flags
|
||||
flags := commandDefintion.Flags()
|
||||
flags.BoolVarP(&NoModTime, "no-modtime", "", NoModTime, "Don't read/write the modification time (can speed things up).")
|
||||
flags.BoolVarP(&NoChecksum, "no-checksum", "", NoChecksum, "Don't compare checksums on up/download.")
|
||||
flags.BoolVarP(&DebugFUSE, "debug-fuse", "", DebugFUSE, "Debug the FUSE internals - needs -v.")
|
||||
flags.BoolVarP(&NoSeek, "no-seek", "", NoSeek, "Don't allow seeking in files.")
|
||||
flags.DurationVarP(&DirCacheTime, "dir-cache-time", "", DirCacheTime, "Time to cache directory entries for.")
|
||||
flags.DurationVarP(&PollInterval, "poll-interval", "", PollInterval, "Time to wait between polling for changes. Must be smaller than dir-cache-time. Only on supported remotes. Set to 0 to disable.")
|
||||
// mount options
|
||||
flags.BoolVarP(&ReadOnly, "read-only", "", ReadOnly, "Mount read-only.")
|
||||
flags.BoolVarP(&AllowNonEmpty, "allow-non-empty", "", AllowNonEmpty, "Allow mounting over a non-empty directory.")
|
||||
flags.BoolVarP(&AllowRoot, "allow-root", "", AllowRoot, "Allow access to root user.")
|
||||
flags.BoolVarP(&AllowOther, "allow-other", "", AllowOther, "Allow access to other users.")
|
||||
flags.BoolVarP(&DefaultPermissions, "default-permissions", "", DefaultPermissions, "Makes kernel enforce access control based on the file mode.")
|
||||
flags.BoolVarP(&WritebackCache, "write-back-cache", "", WritebackCache, "Makes kernel buffer writes before sending them to rclone. Without this, writethrough caching is used.")
|
||||
flags.VarP(&MaxReadAhead, "max-read-ahead", "", "The number of bytes that can be prefetched for sequential reads.")
|
||||
ExtraOptions = flags.StringArrayP("option", "o", []string{}, "Option for libfuse/WinFsp. Repeat if required.")
|
||||
ExtraFlags = flags.StringArrayP("fuse-flag", "", []string{}, "Flags or arguments to be passed direct to libfuse/WinFsp. Repeat if required.")
|
||||
//flags.BoolVarP(&foreground, "foreground", "", foreground, "Do not detach.")
|
||||
|
||||
platformFlags(flags)
|
||||
return commandDefintion
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// +build !linux,!darwin,!freebsd
|
||||
|
||||
package mountlib
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
// add any extra platform specific flags
|
||||
func platformFlags(flags *pflag.FlagSet) {
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package mountlib
|
||||
|
||||
import (
|
||||
"github.com/spf13/pflag"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// add any extra platform specific flags
|
||||
func platformFlags(flags *pflag.FlagSet) {
|
||||
flags.IntVarP(&Umask, "umask", "", Umask, "Override the permission bits set by the filesystem.")
|
||||
Umask = unix.Umask(0) // read the umask
|
||||
unix.Umask(Umask) // set it back to what it was
|
||||
UID = uint32(unix.Geteuid())
|
||||
GID = uint32(unix.Getegid())
|
||||
flags.Uint32VarP(&UID, "uid", "", UID, "Override the uid field set by the filesystem.")
|
||||
flags.Uint32VarP(&GID, "gid", "", GID, "Override the gid field set by the filesystem.")
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package mount
|
||||
package mounttest
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// TestDirLs checks out listing
|
||||
func TestDirLs(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -27,6 +27,7 @@ func TestDirLs(t *testing.T) {
|
||||
run.checkDir(t, "")
|
||||
}
|
||||
|
||||
// TestDirCreateAndRemoveDir tests creating and removing a directory
|
||||
func TestDirCreateAndRemoveDir(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -45,6 +46,7 @@ func TestDirCreateAndRemoveDir(t *testing.T) {
|
||||
run.checkDir(t, "")
|
||||
}
|
||||
|
||||
// TestDirCreateAndRemoveFile tests creating and removing a file
|
||||
func TestDirCreateAndRemoveFile(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -64,6 +66,7 @@ func TestDirCreateAndRemoveFile(t *testing.T) {
|
||||
run.checkDir(t, "")
|
||||
}
|
||||
|
||||
// TestDirRenameFile tests renaming a file
|
||||
func TestDirRenameFile(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -92,6 +95,7 @@ func TestDirRenameFile(t *testing.T) {
|
||||
run.checkDir(t, "")
|
||||
}
|
||||
|
||||
// TestDirRenameEmptyDir tests renaming and empty directory
|
||||
func TestDirRenameEmptyDir(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -112,6 +116,7 @@ func TestDirRenameEmptyDir(t *testing.T) {
|
||||
run.checkDir(t, "")
|
||||
}
|
||||
|
||||
// TestDirRenameFullDir tests renaming a full directory
|
||||
func TestDirRenameFullDir(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -133,3 +138,92 @@ func TestDirRenameFullDir(t *testing.T) {
|
||||
run.rmdir(t, "dir")
|
||||
run.checkDir(t, "")
|
||||
}
|
||||
|
||||
// TestDirModTime tests mod times
|
||||
func TestDirModTime(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
run.mkdir(t, "dir")
|
||||
mtime := time.Date(2012, 11, 18, 17, 32, 31, 0, time.UTC)
|
||||
err := os.Chtimes(run.path("dir"), mtime, mtime)
|
||||
require.NoError(t, err)
|
||||
|
||||
info, err := os.Stat(run.path("dir"))
|
||||
require.NoError(t, err)
|
||||
|
||||
// avoid errors because of timezone differences
|
||||
assert.Equal(t, info.ModTime().Unix(), mtime.Unix())
|
||||
|
||||
run.rmdir(t, "dir")
|
||||
}
|
||||
|
||||
// TestDirCacheFlush tests fluching the dir cache
|
||||
func TestDirCacheFlush(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
run.checkDir(t, "")
|
||||
|
||||
run.mkdir(t, "dir")
|
||||
run.mkdir(t, "otherdir")
|
||||
run.createFile(t, "dir/file", "1")
|
||||
run.createFile(t, "otherdir/file", "1")
|
||||
|
||||
dm := newDirMap("otherdir/|otherdir/file 1|dir/|dir/file 1")
|
||||
localDm := make(dirMap)
|
||||
run.readLocal(t, localDm, "")
|
||||
assert.Equal(t, dm, localDm, "expected vs fuse mount")
|
||||
|
||||
err := run.fremote.Mkdir("dir/subdir")
|
||||
require.NoError(t, err)
|
||||
|
||||
root, err := run.filesys.Root()
|
||||
require.NoError(t, err)
|
||||
|
||||
// expect newly created "subdir" on remote to not show up
|
||||
root.ForgetPath("otherdir")
|
||||
run.readLocal(t, localDm, "")
|
||||
assert.Equal(t, dm, localDm, "expected vs fuse mount")
|
||||
|
||||
root.ForgetPath("dir")
|
||||
dm = newDirMap("otherdir/|otherdir/file 1|dir/|dir/file 1|dir/subdir/")
|
||||
run.readLocal(t, localDm, "")
|
||||
assert.Equal(t, dm, localDm, "expected vs fuse mount")
|
||||
|
||||
run.rm(t, "otherdir/file")
|
||||
run.rmdir(t, "otherdir")
|
||||
run.rm(t, "dir/file")
|
||||
run.rmdir(t, "dir/subdir")
|
||||
run.rmdir(t, "dir")
|
||||
run.checkDir(t, "")
|
||||
}
|
||||
|
||||
// TestDirCacheFlushOnDirRename tests flushing the dir cache on rename
|
||||
func TestDirCacheFlushOnDirRename(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
run.mkdir(t, "dir")
|
||||
run.createFile(t, "dir/file", "1")
|
||||
|
||||
dm := newDirMap("dir/|dir/file 1")
|
||||
localDm := make(dirMap)
|
||||
run.readLocal(t, localDm, "")
|
||||
assert.Equal(t, dm, localDm, "expected vs fuse mount")
|
||||
|
||||
// expect remotely created directory to not show up
|
||||
err := run.fremote.Mkdir("dir/subdir")
|
||||
require.NoError(t, err)
|
||||
run.readLocal(t, localDm, "")
|
||||
assert.Equal(t, dm, localDm, "expected vs fuse mount")
|
||||
|
||||
err = os.Rename(run.path("dir"), run.path("rid"))
|
||||
require.NoError(t, err)
|
||||
|
||||
dm = newDirMap("rid/|rid/subdir/|rid/file 1")
|
||||
localDm = make(dirMap)
|
||||
run.readLocal(t, localDm, "")
|
||||
assert.Equal(t, dm, localDm, "expected vs fuse mount")
|
||||
|
||||
run.rm(t, "rid/file")
|
||||
run.rmdir(t, "rid/subdir")
|
||||
run.rmdir(t, "rid")
|
||||
run.checkDir(t, "")
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package mounttest
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// TestFileModTime tests mod times on files
|
||||
func TestFileModTime(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
run.createFile(t, "file", "123")
|
||||
|
||||
mtime := time.Date(2012, 11, 18, 17, 32, 31, 0, time.UTC)
|
||||
err := os.Chtimes(run.path("file"), mtime, mtime)
|
||||
require.NoError(t, err)
|
||||
|
||||
info, err := os.Stat(run.path("file"))
|
||||
require.NoError(t, err)
|
||||
|
||||
// avoid errors because of timezone differences
|
||||
assert.Equal(t, info.ModTime().Unix(), mtime.Unix())
|
||||
|
||||
run.rm(t, "file")
|
||||
}
|
||||
|
||||
// TestFileModTimeWithOpenWriters tests mod time on open files
|
||||
func TestFileModTimeWithOpenWriters(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
mtime := time.Date(2012, 11, 18, 17, 32, 31, 0, time.UTC)
|
||||
filepath := run.path("cp-archive-test")
|
||||
|
||||
f, err := os.Create(filepath)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = f.Write([]byte{104, 105})
|
||||
require.NoError(t, err)
|
||||
|
||||
err = os.Chtimes(filepath, mtime, mtime)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = f.Close()
|
||||
require.NoError(t, err)
|
||||
|
||||
info, err := os.Stat(filepath)
|
||||
require.NoError(t, err)
|
||||
|
||||
// avoid errors because of timezone differences
|
||||
assert.Equal(t, info.ModTime().Unix(), mtime.Unix())
|
||||
|
||||
run.rm(t, "cp-archive-test")
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
// +build linux darwin freebsd
|
||||
|
||||
// Test suite for rclonefs
|
||||
|
||||
package mount
|
||||
package mounttest
|
||||
|
||||
import (
|
||||
"flag"
|
||||
@@ -12,11 +10,14 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ncw/rclone/cmd/mountlib"
|
||||
"github.com/ncw/rclone/fs"
|
||||
_ "github.com/ncw/rclone/fs/all"
|
||||
_ "github.com/ncw/rclone/fs/all" // import all the file systems
|
||||
"github.com/ncw/rclone/fstest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -33,8 +34,20 @@ var (
|
||||
LowLevelRetries = flag.Int("low-level-retries", 10, "Number of low level retries")
|
||||
)
|
||||
|
||||
type (
|
||||
// UnmountFn is called to unmount the file system
|
||||
UnmountFn func() error
|
||||
// MountFn is called to mount the file system
|
||||
MountFn func(f fs.Fs, mountpoint string) (*mountlib.FS, <-chan error, func() error, error)
|
||||
)
|
||||
|
||||
var (
|
||||
mountFn MountFn
|
||||
)
|
||||
|
||||
// TestMain drives the tests
|
||||
func TestMain(m *testing.M) {
|
||||
func TestMain(m *testing.M, fn MountFn) {
|
||||
mountFn = fn
|
||||
flag.Parse()
|
||||
run = newRun()
|
||||
rc := m.Run()
|
||||
@@ -44,11 +57,13 @@ func TestMain(m *testing.M) {
|
||||
|
||||
// Run holds the remotes for a test run
|
||||
type Run struct {
|
||||
filesys *mountlib.FS
|
||||
mountPath string
|
||||
fremote fs.Fs
|
||||
fremoteName string
|
||||
cleanRemote func()
|
||||
umountResult <-chan error
|
||||
umountFn UnmountFn
|
||||
skip bool
|
||||
}
|
||||
|
||||
@@ -88,9 +103,24 @@ func newRun() *Run {
|
||||
log.Fatalf("Failed to open mkdir %q: %v", *RemoteName, err)
|
||||
}
|
||||
|
||||
r.mountPath, err = ioutil.TempDir("", "rclonefs-mount")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create mount dir: %v", err)
|
||||
if runtime.GOOS != "windows" {
|
||||
r.mountPath, err = ioutil.TempDir("", "rclonefs-mount")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create mount dir: %v", err)
|
||||
}
|
||||
} else {
|
||||
// Find a free drive letter
|
||||
drive := ""
|
||||
for letter := 'E'; letter <= 'Z'; letter++ {
|
||||
drive = string(letter) + ":"
|
||||
_, err := os.Stat(drive + "\\")
|
||||
if os.IsNotExist(err) {
|
||||
goto found
|
||||
}
|
||||
}
|
||||
log.Fatalf("Couldn't find free drive letter for test")
|
||||
found:
|
||||
r.mountPath = drive
|
||||
}
|
||||
|
||||
// Mount it up
|
||||
@@ -102,7 +132,7 @@ func newRun() *Run {
|
||||
func (r *Run) mount() {
|
||||
log.Printf("mount %q %q", r.fremote, r.mountPath)
|
||||
var err error
|
||||
r.umountResult, err = mount(r.fremote, r.mountPath)
|
||||
r.filesys, r.umountResult, r.umountFn, err = mountFn(r.fremote, r.mountPath)
|
||||
if err != nil {
|
||||
log.Printf("mount failed: %v", err)
|
||||
r.skip = true
|
||||
@@ -115,10 +145,22 @@ func (r *Run) umount() {
|
||||
log.Printf("FUSE not found so skipping umount")
|
||||
return
|
||||
}
|
||||
log.Printf("Calling fusermount -u %q", r.mountPath)
|
||||
err := exec.Command("fusermount", "-u", r.mountPath).Run()
|
||||
/*
|
||||
log.Printf("Calling fusermount -u %q", r.mountPath)
|
||||
err := exec.Command("fusermount", "-u", r.mountPath).Run()
|
||||
if err != nil {
|
||||
log.Printf("fusermount failed: %v", err)
|
||||
}
|
||||
*/
|
||||
log.Printf("Unmounting %q", r.mountPath)
|
||||
err := r.umountFn()
|
||||
if err != nil {
|
||||
log.Printf("fusermount failed: %v", err)
|
||||
log.Printf("signal to umount failed - retrying: %v", err)
|
||||
time.Sleep(3 * time.Second)
|
||||
err = r.umountFn()
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatalf("signal to umount failed: %v", err)
|
||||
}
|
||||
log.Printf("Waiting for umount")
|
||||
err = <-r.umountResult
|
||||
@@ -144,6 +186,10 @@ func (r *Run) Finalise() {
|
||||
}
|
||||
|
||||
func (r *Run) path(filepath string) string {
|
||||
// return windows drive letter root as E:/
|
||||
if filepath == "" && runtime.GOOS == "windows" {
|
||||
return run.mountPath + "/"
|
||||
}
|
||||
return path.Join(run.mountPath, filepath)
|
||||
}
|
||||
|
||||
@@ -181,17 +227,17 @@ func (r *Run) readLocal(t *testing.T, dir dirMap, filepath string) {
|
||||
if fi.IsDir() {
|
||||
dir[name+"/"] = struct{}{}
|
||||
r.readLocal(t, dir, name)
|
||||
assert.Equal(t, fi.Mode().Perm(), os.FileMode(dirPerms))
|
||||
assert.Equal(t, mountlib.DirPerms, fi.Mode().Perm())
|
||||
} else {
|
||||
dir[fmt.Sprintf("%s %d", name, fi.Size())] = struct{}{}
|
||||
assert.Equal(t, fi.Mode().Perm(), os.FileMode(filePerms))
|
||||
assert.Equal(t, mountlib.FilePerms, fi.Mode().Perm())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reads the remote tree into dir
|
||||
func (r *Run) readRemote(t *testing.T, dir dirMap, filepath string) {
|
||||
objs, dirs, err := fs.NewLister().SetLevel(1).Start(r.fremote, filepath).GetAll()
|
||||
objs, dirs, err := fs.WalkGetAll(r.fremote, filepath, true, 1)
|
||||
if err == fs.ErrorDirNotFound {
|
||||
return
|
||||
}
|
||||
@@ -249,8 +295,8 @@ func (r *Run) rmdir(t *testing.T, filepath string) {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
// Check that the Fs is mounted by seeing if the mountpoint is
|
||||
// in the mount output
|
||||
// TestMount checks that the Fs is mounted by seeing if the mountpoint
|
||||
// is in the mount output
|
||||
func TestMount(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -259,12 +305,12 @@ func TestMount(t *testing.T) {
|
||||
assert.Contains(t, string(out), run.mountPath)
|
||||
}
|
||||
|
||||
// Check root directory is present and correct
|
||||
// TestRoot checks root directory is present and correct
|
||||
func TestRoot(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
fi, err := os.Lstat(run.mountPath)
|
||||
require.NoError(t, err)
|
||||
assert.True(t, fi.IsDir())
|
||||
assert.Equal(t, fi.Mode().Perm(), os.FileMode(dirPerms))
|
||||
assert.Equal(t, fi.Mode().Perm(), mountlib.DirPerms)
|
||||
}
|
||||
@@ -1,18 +1,15 @@
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package mount
|
||||
package mounttest
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// Read by byte including don't read any bytes
|
||||
// TestReadByByte reads by byte including don't read any bytes
|
||||
func TestReadByByte(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -37,49 +34,48 @@ func TestReadByByte(t *testing.T) {
|
||||
run.rm(t, "testfile")
|
||||
}
|
||||
|
||||
// Test double close
|
||||
func TestReadFileDoubleClose(t *testing.T) {
|
||||
// TestReadChecksum checks the checksum reading is working
|
||||
func TestReadChecksum(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
run.createFile(t, "testdoubleclose", "hello")
|
||||
// create file big enough so we exceed any single FUSE read
|
||||
// request
|
||||
b := make([]rune, 3*128*1024)
|
||||
for i := range b {
|
||||
b[i] = 'r'
|
||||
}
|
||||
run.createFile(t, "bigfile", string(b))
|
||||
|
||||
in, err := os.Open(run.path("testdoubleclose"))
|
||||
// The hash comparison would fail in Flush, if we did not
|
||||
// ensure we read the whole file
|
||||
fd, err := os.Open(run.path("bigfile"))
|
||||
assert.NoError(t, err)
|
||||
fd := in.Fd()
|
||||
|
||||
fd1, err := syscall.Dup(int(fd))
|
||||
buf := make([]byte, 10)
|
||||
_, err = io.ReadFull(fd, buf)
|
||||
assert.NoError(t, err)
|
||||
err = fd.Close()
|
||||
assert.NoError(t, err)
|
||||
|
||||
fd2, err := syscall.Dup(int(fd))
|
||||
// The hash comparison would fail, because we only read parts
|
||||
// of the file
|
||||
fd, err = os.Open(run.path("bigfile"))
|
||||
assert.NoError(t, err)
|
||||
// read at start
|
||||
_, err = io.ReadFull(fd, buf)
|
||||
assert.NoError(t, err)
|
||||
// read at end
|
||||
_, err = fd.Seek(int64(len(b)-len(buf)), 0)
|
||||
assert.NoError(t, err)
|
||||
_, err = io.ReadFull(fd, buf)
|
||||
assert.NoError(t, err)
|
||||
// ensure we don't compare hashes
|
||||
err = fd.Close()
|
||||
assert.NoError(t, err)
|
||||
|
||||
// close one of the dups - should produce no error
|
||||
err = syscall.Close(fd1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// read from the file
|
||||
buf := make([]byte, 1)
|
||||
_, err = in.Read(buf)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// close it
|
||||
err = in.Close()
|
||||
assert.NoError(t, err)
|
||||
|
||||
// read from the other dup - should produce no error as this
|
||||
// file is now buffered
|
||||
n, err := syscall.Read(fd2, buf)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 1, n)
|
||||
|
||||
// close the dup - should not produce an error
|
||||
err = syscall.Close(fd2)
|
||||
assert.NoError(t, err, "input/output error")
|
||||
|
||||
run.rm(t, "testdoubleclose")
|
||||
run.rm(t, "bigfile")
|
||||
}
|
||||
|
||||
// Test seeking
|
||||
// TestReadSeek test seeking
|
||||
func TestReadSeek(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// +build !linux,!darwin,!freebsd
|
||||
|
||||
package mounttest
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestReadFileDoubleClose tests double close on read
|
||||
func TestReadFileDoubleClose(t *testing.T) {
|
||||
t.Skip("not supported on " + runtime.GOOS)
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package mounttest
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// TestReadFileDoubleClose tests double close on read
|
||||
func TestReadFileDoubleClose(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
run.createFile(t, "testdoubleclose", "hello")
|
||||
|
||||
in, err := os.Open(run.path("testdoubleclose"))
|
||||
assert.NoError(t, err)
|
||||
fd := in.Fd()
|
||||
|
||||
fd1, err := syscall.Dup(int(fd))
|
||||
assert.NoError(t, err)
|
||||
|
||||
fd2, err := syscall.Dup(int(fd))
|
||||
assert.NoError(t, err)
|
||||
|
||||
// close one of the dups - should produce no error
|
||||
err = syscall.Close(fd1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// read from the file
|
||||
buf := make([]byte, 1)
|
||||
_, err = in.Read(buf)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// close it
|
||||
err = in.Close()
|
||||
assert.NoError(t, err)
|
||||
|
||||
// read from the other dup - should produce no error as this
|
||||
// file is now buffered
|
||||
n, err := syscall.Read(fd2, buf)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 1, n)
|
||||
|
||||
// close the dup - should not produce an error
|
||||
err = syscall.Close(fd2)
|
||||
assert.NoError(t, err, "input/output error")
|
||||
|
||||
run.rm(t, "testdoubleclose")
|
||||
}
|
||||
@@ -1,17 +1,15 @@
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package mount
|
||||
package mounttest
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// Test writing a file with no write()'s to it
|
||||
// TestWriteFileNoWrite tests writing a file with no write()'s to it
|
||||
func TestWriteFileNoWrite(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -21,12 +19,15 @@ func TestWriteFileNoWrite(t *testing.T) {
|
||||
err = fd.Close()
|
||||
assert.NoError(t, err)
|
||||
|
||||
// FIXME - wait for the Release on the file
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
run.checkDir(t, "testnowrite 0")
|
||||
|
||||
run.rm(t, "testnowrite")
|
||||
}
|
||||
|
||||
// Test open file in directory listing
|
||||
// FIXMETestWriteOpenFileInDirListing tests open file in directory listing
|
||||
func FIXMETestWriteOpenFileInDirListing(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -41,7 +42,7 @@ func FIXMETestWriteOpenFileInDirListing(t *testing.T) {
|
||||
run.rm(t, "testnowrite")
|
||||
}
|
||||
|
||||
// Test writing a file and reading it back
|
||||
// TestWriteFileWrite tests writing a file and reading it back
|
||||
func TestWriteFileWrite(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -52,7 +53,7 @@ func TestWriteFileWrite(t *testing.T) {
|
||||
run.rm(t, "testwrite")
|
||||
}
|
||||
|
||||
// Test overwriting a file
|
||||
// TestWriteFileOverwrite tests overwriting a file
|
||||
func TestWriteFileOverwrite(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
@@ -64,46 +65,7 @@ func TestWriteFileOverwrite(t *testing.T) {
|
||||
run.rm(t, "testwrite")
|
||||
}
|
||||
|
||||
// Test double close
|
||||
func TestWriteFileDoubleClose(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
out, err := os.Create(run.path("testdoubleclose"))
|
||||
assert.NoError(t, err)
|
||||
fd := out.Fd()
|
||||
|
||||
fd1, err := syscall.Dup(int(fd))
|
||||
assert.NoError(t, err)
|
||||
|
||||
fd2, err := syscall.Dup(int(fd))
|
||||
assert.NoError(t, err)
|
||||
|
||||
// close one of the dups - should produce no error
|
||||
err = syscall.Close(fd1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// write to the file
|
||||
buf := []byte("hello")
|
||||
n, err := out.Write(buf)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 5, n)
|
||||
|
||||
// close it
|
||||
err = out.Close()
|
||||
assert.NoError(t, err)
|
||||
|
||||
// write to the other dup - should produce an error
|
||||
n, err = syscall.Write(fd2, buf)
|
||||
assert.Error(t, err, "input/output error")
|
||||
|
||||
// close the dup - should produce an error
|
||||
err = syscall.Close(fd2)
|
||||
assert.Error(t, err, "input/output error")
|
||||
|
||||
run.rm(t, "testdoubleclose")
|
||||
}
|
||||
|
||||
// Test Fsync
|
||||
// TestWriteFileFsync tests Fsync
|
||||
//
|
||||
// NB the code for this is in file.go rather than write.go
|
||||
func TestWriteFileFsync(t *testing.T) {
|
||||
@@ -0,0 +1,13 @@
|
||||
// +build !linux,!darwin,!freebsd
|
||||
|
||||
package mounttest
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestWriteFileDoubleClose tests double close on write
|
||||
func TestWriteFileDoubleClose(t *testing.T) {
|
||||
t.Skip("not supported on " + runtime.GOOS)
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package mounttest
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// TestWriteFileDoubleClose tests double close on write
|
||||
func TestWriteFileDoubleClose(t *testing.T) {
|
||||
run.skipIfNoFUSE(t)
|
||||
|
||||
out, err := os.Create(run.path("testdoubleclose"))
|
||||
assert.NoError(t, err)
|
||||
fd := out.Fd()
|
||||
|
||||
fd1, err := syscall.Dup(int(fd))
|
||||
assert.NoError(t, err)
|
||||
|
||||
fd2, err := syscall.Dup(int(fd))
|
||||
assert.NoError(t, err)
|
||||
|
||||
// close one of the dups - should produce no error
|
||||
err = syscall.Close(fd1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// write to the file
|
||||
buf := []byte("hello")
|
||||
n, err := out.Write(buf)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 5, n)
|
||||
|
||||
// close it
|
||||
err = out.Close()
|
||||
assert.NoError(t, err)
|
||||
|
||||
// write to the other dup - should produce an error
|
||||
_, err = syscall.Write(fd2, buf)
|
||||
assert.Error(t, err, "input/output error")
|
||||
|
||||
// close the dup - should produce an error
|
||||
err = syscall.Close(fd2)
|
||||
assert.Error(t, err, "input/output error")
|
||||
|
||||
run.rm(t, "testdoubleclose")
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
package mountlib
|
||||
|
||||
import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// ReadFileHandle is an open for read file handle on a File
|
||||
type ReadFileHandle struct {
|
||||
mu sync.Mutex
|
||||
closed bool // set if handle has been closed
|
||||
r *fs.Account
|
||||
o fs.Object
|
||||
readCalled bool // set if read has been called
|
||||
offset int64
|
||||
noSeek bool
|
||||
file *File
|
||||
hash *fs.MultiHasher
|
||||
opened bool
|
||||
}
|
||||
|
||||
func newReadFileHandle(f *File, o fs.Object) (*ReadFileHandle, error) {
|
||||
var hash *fs.MultiHasher
|
||||
var err error
|
||||
if !f.d.fsys.noChecksum {
|
||||
hash, err = fs.NewMultiHasherTypes(o.Fs().Hashes())
|
||||
if err != nil {
|
||||
fs.Errorf(o.Fs(), "newReadFileHandle hash error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
fh := &ReadFileHandle{
|
||||
o: o,
|
||||
noSeek: f.d.fsys.noSeek,
|
||||
file: f,
|
||||
hash: hash,
|
||||
}
|
||||
fs.Stats.Transferring(fh.o.Remote())
|
||||
return fh, nil
|
||||
}
|
||||
|
||||
// openPending opens the file if there is a pending open
|
||||
// call with the lock held
|
||||
func (fh *ReadFileHandle) openPending() (err error) {
|
||||
if fh.opened {
|
||||
return nil
|
||||
}
|
||||
r, err := fh.o.Open()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fh.r = fs.NewAccount(r, fh.o).WithBuffer() // account the transfer
|
||||
fh.opened = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// String converts it to printable
|
||||
func (fh *ReadFileHandle) String() string {
|
||||
if fh == nil {
|
||||
return "<nil *ReadFileHandle>"
|
||||
}
|
||||
if fh.file == nil {
|
||||
return "<nil *ReadFileHandle.file>"
|
||||
}
|
||||
return fh.file.String() + " (r)"
|
||||
}
|
||||
|
||||
// Node returns the Node assocuated with this - satisfies Noder interface
|
||||
func (fh *ReadFileHandle) Node() Node {
|
||||
return fh.file
|
||||
}
|
||||
|
||||
// seek to a new offset
|
||||
//
|
||||
// if reopen is true, then we won't attempt to use an io.Seeker interface
|
||||
//
|
||||
// Must be called with fh.mu held
|
||||
func (fh *ReadFileHandle) seek(offset int64, reopen bool) (err error) {
|
||||
if fh.noSeek {
|
||||
return ESPIPE
|
||||
}
|
||||
fh.r.StopBuffering() // stop the background reading first
|
||||
fh.hash = nil
|
||||
oldReader := fh.r.GetReader()
|
||||
r := oldReader
|
||||
// Can we seek it directly?
|
||||
if do, ok := oldReader.(io.Seeker); !reopen && ok {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.seek from %d to %d (io.Seeker)", fh.offset, offset)
|
||||
_, err = do.Seek(offset, 0)
|
||||
if err != nil {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Read io.Seeker failed: %v", err)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.seek from %d to %d", fh.offset, offset)
|
||||
// close old one
|
||||
err = oldReader.Close()
|
||||
if err != nil {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Read seek close old failed: %v", err)
|
||||
}
|
||||
// re-open with a seek
|
||||
r, err = fh.o.Open(&fs.SeekOption{Offset: offset})
|
||||
if err != nil {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Read seek failed: %v", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
fh.r.UpdateReader(r)
|
||||
fh.offset = offset
|
||||
return nil
|
||||
}
|
||||
|
||||
// Read from the file handle
|
||||
func (fh *ReadFileHandle) Read(reqSize, reqOffset int64) (respData []byte, err error) {
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
err = fh.openPending() // FIXME pending open could be more efficient in the presense of seek (and retried)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// fs.Debugf(fh.o, "ReadFileHandle.Read size %d offset %d", reqSize, reqOffset)
|
||||
if fh.closed {
|
||||
fs.Errorf(fh.o, "ReadFileHandle.Read error: %v", EBADF)
|
||||
return nil, EBADF
|
||||
}
|
||||
doSeek := reqOffset != fh.offset
|
||||
var n int
|
||||
var newOffset int64
|
||||
retries := 0
|
||||
buf := make([]byte, reqSize)
|
||||
doReopen := false
|
||||
for {
|
||||
if doSeek {
|
||||
// Are we attempting to seek beyond the end of the
|
||||
// file - if so just return EOF leaving the underlying
|
||||
// file in an unchanged state.
|
||||
if reqOffset >= fh.o.Size() {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Read attempt to read beyond end of file: %d > %d", reqOffset, fh.o.Size())
|
||||
return nil, nil
|
||||
}
|
||||
// Otherwise do the seek
|
||||
err = fh.seek(reqOffset, doReopen)
|
||||
} else {
|
||||
err = nil
|
||||
}
|
||||
if err == nil {
|
||||
if reqSize > 0 {
|
||||
fh.readCalled = true
|
||||
}
|
||||
// One exception to the above is if we fail to fully populate a
|
||||
// page cache page; a read into page cache is always page aligned.
|
||||
// Make sure we never serve a partial read, to avoid that.
|
||||
n, err = io.ReadFull(fh.r, buf)
|
||||
newOffset = fh.offset + int64(n)
|
||||
// if err == nil && rand.Intn(10) == 0 {
|
||||
// err = errors.New("random error")
|
||||
// }
|
||||
if err == nil {
|
||||
break
|
||||
} else if (err == io.ErrUnexpectedEOF || err == io.EOF) && newOffset == fh.o.Size() {
|
||||
// Have read to end of file - reset error
|
||||
err = nil
|
||||
break
|
||||
}
|
||||
}
|
||||
if retries >= fs.Config.LowLevelRetries {
|
||||
break
|
||||
}
|
||||
retries++
|
||||
fs.Errorf(fh.o, "ReadFileHandle.Read error: low level retry %d/%d: %v", retries, fs.Config.LowLevelRetries, err)
|
||||
doSeek = true
|
||||
doReopen = true
|
||||
}
|
||||
if err != nil {
|
||||
fs.Errorf(fh.o, "ReadFileHandle.Read error: %v", err)
|
||||
} else {
|
||||
respData = buf[:n]
|
||||
fh.offset = newOffset
|
||||
// fs.Debugf(fh.o, "ReadFileHandle.Read OK")
|
||||
|
||||
if fh.hash != nil {
|
||||
_, err = fh.hash.Write(respData)
|
||||
if err != nil {
|
||||
fs.Errorf(fh.o, "ReadFileHandle.Read HashError: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
return respData, err
|
||||
}
|
||||
|
||||
func (fh *ReadFileHandle) checkHash() error {
|
||||
if fh.hash == nil || !fh.readCalled || fh.offset < fh.o.Size() {
|
||||
return nil
|
||||
}
|
||||
|
||||
for hashType, dstSum := range fh.hash.Sums() {
|
||||
srcSum, err := fh.o.Hash(hashType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !fs.HashEquals(dstSum, srcSum) {
|
||||
return errors.Errorf("corrupted on transfer: %v hash differ %q vs %q", hashType, dstSum, srcSum)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// close the file handle returning EBADF if it has been
|
||||
// closed already.
|
||||
//
|
||||
// Must be called with fh.mu held
|
||||
func (fh *ReadFileHandle) close() error {
|
||||
if fh.closed {
|
||||
return EBADF
|
||||
}
|
||||
fh.closed = true
|
||||
fs.Stats.DoneTransferring(fh.o.Remote(), true)
|
||||
|
||||
if err := fh.checkHash(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return fh.r.Close()
|
||||
}
|
||||
|
||||
// Flush is called each time the file or directory is closed.
|
||||
// Because there can be multiple file descriptors referring to a
|
||||
// single opened file, Flush can be called multiple times.
|
||||
func (fh *ReadFileHandle) Flush() error {
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
if !fh.opened {
|
||||
return nil
|
||||
}
|
||||
// fs.Debugf(fh.o, "ReadFileHandle.Flush")
|
||||
|
||||
if err := fh.checkHash(); err != nil {
|
||||
fs.Errorf(fh.o, "ReadFileHandle.Flush error: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
// fs.Debugf(fh.o, "ReadFileHandle.Flush OK")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Release is called when we are finished with the file handle
|
||||
//
|
||||
// It isn't called directly from userspace so the error is ignored by
|
||||
// the kernel
|
||||
func (fh *ReadFileHandle) Release() error {
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
if !fh.opened {
|
||||
return nil
|
||||
}
|
||||
if fh.closed {
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Release nothing to do")
|
||||
return nil
|
||||
}
|
||||
fs.Debugf(fh.o, "ReadFileHandle.Release closing")
|
||||
err := fh.close()
|
||||
if err != nil {
|
||||
fs.Errorf(fh.o, "ReadFileHandle.Release error: %v", err)
|
||||
} else {
|
||||
// fs.Debugf(fh.o, "ReadFileHandle.Release OK")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package mountlib
|
||||
|
||||
import (
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// WriteFileHandle is an open for write handle on a File
|
||||
type WriteFileHandle struct {
|
||||
mu sync.Mutex
|
||||
closed bool // set if handle has been closed
|
||||
remote string
|
||||
pipeWriter *io.PipeWriter
|
||||
o fs.Object
|
||||
result chan error
|
||||
file *File
|
||||
writeCalled bool // set the first time Write() is called
|
||||
offset int64
|
||||
hash *fs.MultiHasher
|
||||
}
|
||||
|
||||
func newWriteFileHandle(d *Dir, f *File, src fs.ObjectInfo) (*WriteFileHandle, error) {
|
||||
var hash *fs.MultiHasher
|
||||
if !f.d.fsys.noChecksum {
|
||||
var err error
|
||||
hash, err = fs.NewMultiHasherTypes(src.Fs().Hashes())
|
||||
if err != nil {
|
||||
fs.Errorf(src.Fs(), "newWriteFileHandle hash error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
fh := &WriteFileHandle{
|
||||
remote: src.Remote(),
|
||||
result: make(chan error, 1),
|
||||
file: f,
|
||||
hash: hash,
|
||||
}
|
||||
var pipeReader *io.PipeReader
|
||||
pipeReader, fh.pipeWriter = io.Pipe()
|
||||
go func() {
|
||||
r := fs.NewAccountSizeName(pipeReader, 0, src.Remote()).WithBuffer() // account the transfer
|
||||
o, err := d.f.Put(r, src)
|
||||
if err != nil {
|
||||
fs.Errorf(fh.remote, "WriteFileHandle.New Put failed: %v", err)
|
||||
}
|
||||
// Close the Account and thus the pipeReader so the pipeWriter fails with ErrClosedPipe
|
||||
_ = r.Close()
|
||||
fh.o = o
|
||||
fh.result <- err
|
||||
}()
|
||||
fh.file.addWriters(1)
|
||||
fh.file.setSize(0)
|
||||
fs.Stats.Transferring(fh.remote)
|
||||
return fh, nil
|
||||
}
|
||||
|
||||
// String converts it to printable
|
||||
func (fh *WriteFileHandle) String() string {
|
||||
if fh == nil {
|
||||
return "<nil *WriteFileHandle>"
|
||||
}
|
||||
if fh.file == nil {
|
||||
return "<nil *WriteFileHandle.file>"
|
||||
}
|
||||
return fh.file.String() + " (w)"
|
||||
}
|
||||
|
||||
// Node returns the Node assocuated with this - satisfies Noder interface
|
||||
func (fh *WriteFileHandle) Node() Node {
|
||||
return fh.file
|
||||
}
|
||||
|
||||
// Write data to the file handle
|
||||
func (fh *WriteFileHandle) Write(data []byte, offset int64) (written int64, err error) {
|
||||
// fs.Debugf(fh.remote, "WriteFileHandle.Write len=%d", len(data))
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
if fh.offset != offset {
|
||||
fs.Errorf(fh.remote, "WriteFileHandle.Write can't seek in file")
|
||||
return 0, ESPIPE
|
||||
}
|
||||
if fh.closed {
|
||||
fs.Errorf(fh.remote, "WriteFileHandle.Write error: %v", EBADF)
|
||||
return 0, EBADF
|
||||
}
|
||||
fh.writeCalled = true
|
||||
// FIXME should probably check the file isn't being seeked?
|
||||
n, err := fh.pipeWriter.Write(data)
|
||||
written = int64(n)
|
||||
fh.offset += written
|
||||
fh.file.setSize(fh.offset)
|
||||
if err != nil {
|
||||
fs.Errorf(fh.remote, "WriteFileHandle.Write error: %v", err)
|
||||
return 0, err
|
||||
}
|
||||
// fs.Debugf(fh.remote, "WriteFileHandle.Write OK (%d bytes written)", n)
|
||||
if fh.hash != nil {
|
||||
_, err = fh.hash.Write(data[:n])
|
||||
if err != nil {
|
||||
fs.Errorf(fh.remote, "WriteFileHandle.Write HashError: %v", err)
|
||||
return written, err
|
||||
}
|
||||
}
|
||||
return written, nil
|
||||
}
|
||||
|
||||
// Offset returns the offset of the file pointer
|
||||
func (fh *WriteFileHandle) Offset() (offset int64) {
|
||||
return fh.offset
|
||||
}
|
||||
|
||||
// close the file handle returning EBADF if it has been
|
||||
// closed already.
|
||||
//
|
||||
// Must be called with fh.mu held
|
||||
func (fh *WriteFileHandle) close() error {
|
||||
if fh.closed {
|
||||
return EBADF
|
||||
}
|
||||
fh.closed = true
|
||||
fs.Stats.DoneTransferring(fh.remote, true)
|
||||
fh.file.addWriters(-1)
|
||||
writeCloseErr := fh.pipeWriter.Close()
|
||||
err := <-fh.result
|
||||
if err == nil {
|
||||
fh.file.setObject(fh.o)
|
||||
err = writeCloseErr
|
||||
}
|
||||
if err == nil && fh.hash != nil {
|
||||
for hashType, srcSum := range fh.hash.Sums() {
|
||||
dstSum, err := fh.o.Hash(hashType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !fs.HashEquals(srcSum, dstSum) {
|
||||
return errors.Errorf("corrupted on transfer: %v hash differ %q vs %q", hashType, srcSum, dstSum)
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// Flush is called on each close() of a file descriptor. So if a
|
||||
// filesystem wants to return write errors in close() and the file has
|
||||
// cached dirty data, this is a good place to write back data and
|
||||
// return any errors. Since many applications ignore close() errors
|
||||
// this is not always useful.
|
||||
//
|
||||
// NOTE: The flush() method may be called more than once for each
|
||||
// open(). This happens if more than one file descriptor refers to an
|
||||
// opened file due to dup(), dup2() or fork() calls. It is not
|
||||
// possible to determine if a flush is final, so each flush should be
|
||||
// treated equally. Multiple write-flush sequences are relatively
|
||||
// rare, so this shouldn't be a problem.
|
||||
//
|
||||
// Filesystems shouldn't assume that flush will always be called after
|
||||
// some writes, or that if will be called at all.
|
||||
func (fh *WriteFileHandle) Flush() error {
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
// fs.Debugf(fh.remote, "WriteFileHandle.Flush")
|
||||
// If Write hasn't been called then ignore the Flush - Release
|
||||
// will pick it up
|
||||
if !fh.writeCalled {
|
||||
fs.Debugf(fh.remote, "WriteFileHandle.Flush ignoring flush on unwritten handle")
|
||||
return nil
|
||||
|
||||
}
|
||||
err := fh.close()
|
||||
if err != nil {
|
||||
fs.Errorf(fh.remote, "WriteFileHandle.Flush error: %v", err)
|
||||
} else {
|
||||
// fs.Debugf(fh.remote, "WriteFileHandle.Flush OK")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// Release is called when we are finished with the file handle
|
||||
//
|
||||
// It isn't called directly from userspace so the error is ignored by
|
||||
// the kernel
|
||||
func (fh *WriteFileHandle) Release() error {
|
||||
fh.mu.Lock()
|
||||
defer fh.mu.Unlock()
|
||||
if fh.closed {
|
||||
fs.Debugf(fh.remote, "WriteFileHandle.Release nothing to do")
|
||||
return nil
|
||||
}
|
||||
fs.Debugf(fh.remote, "WriteFileHandle.Release closing")
|
||||
err := fh.close()
|
||||
if err != nil {
|
||||
fs.Errorf(fh.remote, "WriteFileHandle.Release error: %v", err)
|
||||
} else {
|
||||
// fs.Debugf(fh.remote, "WriteFileHandle.Release OK")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,546 @@
|
||||
// Package ncdu implements a text based user interface for exploring a remote
|
||||
|
||||
//+build !plan9,!solaris
|
||||
|
||||
package ncdu
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/ncw/rclone/cmd"
|
||||
"github.com/ncw/rclone/cmd/ncdu/scan"
|
||||
"github.com/ncw/rclone/fs"
|
||||
termbox "github.com/nsf/termbox-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd.Root.AddCommand(commandDefintion)
|
||||
}
|
||||
|
||||
var commandDefintion = &cobra.Command{
|
||||
Use: "ncdu remote:path",
|
||||
Short: `Explore a remote with a text based user interface.`,
|
||||
Long: `
|
||||
This displays a text based user interface allowing the navigation of a
|
||||
remote. It is most useful for answering the question - "What is using
|
||||
all my disk space?".
|
||||
|
||||
To make the user interface it first scans the entire remote given and
|
||||
builds an in memory representation. rclone ncdu can be used during
|
||||
this scanning phase and you will see it building up the directory
|
||||
structure as it goes along.
|
||||
|
||||
Here are the keys - press '?' to toggle the help on and off
|
||||
|
||||
` + strings.Join(helpText[1:], "\n ") + `
|
||||
|
||||
This an homage to the [ncdu tool](https://dev.yorhel.nl/ncdu) but for
|
||||
rclone remotes. It is missing lots of features at the moment, most
|
||||
importantly deleting files, but is useful as it stands.
|
||||
`,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(1, 1, command, args)
|
||||
fsrc := cmd.NewFsSrc(args)
|
||||
cmd.Run(false, false, command, func() error {
|
||||
return NewUI(fsrc).Show()
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
// help text
|
||||
var helpText = []string{
|
||||
"rclone ncdu",
|
||||
" ↑,↓ or k,j to Move",
|
||||
" →,l to enter",
|
||||
" ←,h to return",
|
||||
" c toggle counts",
|
||||
" g toggle graph",
|
||||
" n,s,C sort by name,size,count",
|
||||
" ? to toggle help on and off",
|
||||
" q/ESC/c-C to quit",
|
||||
}
|
||||
|
||||
// UI contains the state of the user interface
|
||||
type UI struct {
|
||||
f fs.Fs // fs being displayed
|
||||
fsName string // human name of Fs
|
||||
root *scan.Dir // root directory
|
||||
d *scan.Dir // current directory being displayed
|
||||
path string // path of current directory
|
||||
showBox bool // whether to show a box
|
||||
boxText []string // text to show in box
|
||||
entries fs.DirEntries // entries of current directory
|
||||
sortPerm []int // order to display entries in after sorting
|
||||
invSortPerm []int // inverse order
|
||||
dirListHeight int // height of listing
|
||||
listing bool // whether listing is in progress
|
||||
showGraph bool // toggle showing graph
|
||||
showCounts bool // toggle showing counts
|
||||
sortByName int8 // +1 for normal, 0 for off, -1 for reverse
|
||||
sortBySize int8
|
||||
sortByCount int8
|
||||
dirPosMap map[string]dirPos // store for directory positions
|
||||
}
|
||||
|
||||
// Where we have got to in the directory listing
|
||||
type dirPos struct {
|
||||
entry int
|
||||
offset int
|
||||
}
|
||||
|
||||
// Print a string
|
||||
func Print(x, y int, fg, bg termbox.Attribute, msg string) {
|
||||
for _, c := range msg {
|
||||
termbox.SetCell(x, y, c, fg, bg)
|
||||
x++
|
||||
}
|
||||
}
|
||||
|
||||
// Printf a string
|
||||
func Printf(x, y int, fg, bg termbox.Attribute, format string, args ...interface{}) {
|
||||
s := fmt.Sprintf(format, args...)
|
||||
Print(x, y, fg, bg, s)
|
||||
}
|
||||
|
||||
// Line prints a string to given xmax, with given space
|
||||
func Line(x, y, xmax int, fg, bg termbox.Attribute, spacer rune, msg string) {
|
||||
for _, c := range msg {
|
||||
termbox.SetCell(x, y, c, fg, bg)
|
||||
x++
|
||||
if x >= xmax {
|
||||
return
|
||||
}
|
||||
}
|
||||
for ; x < xmax; x++ {
|
||||
termbox.SetCell(x, y, spacer, fg, bg)
|
||||
}
|
||||
}
|
||||
|
||||
// Linef a string
|
||||
func Linef(x, y, xmax int, fg, bg termbox.Attribute, spacer rune, format string, args ...interface{}) {
|
||||
s := fmt.Sprintf(format, args...)
|
||||
Line(x, y, xmax, fg, bg, spacer, s)
|
||||
}
|
||||
|
||||
// Box the u.boxText onto the screen
|
||||
func (u *UI) Box() {
|
||||
w, h := termbox.Size()
|
||||
|
||||
// Find dimensions of text
|
||||
boxWidth := 10
|
||||
for _, s := range u.boxText {
|
||||
if len(s) > boxWidth && len(s) < w-4 {
|
||||
boxWidth = len(s)
|
||||
}
|
||||
}
|
||||
boxHeight := len(u.boxText)
|
||||
|
||||
// position
|
||||
x := (w - boxWidth) / 2
|
||||
y := (h - boxHeight) / 2
|
||||
xmax := x + boxWidth
|
||||
|
||||
// draw text
|
||||
fg, bg := termbox.ColorRed, termbox.ColorWhite
|
||||
for i, s := range u.boxText {
|
||||
Line(x, y+i, xmax, fg, bg, ' ', s)
|
||||
fg = termbox.ColorBlack
|
||||
}
|
||||
|
||||
// FIXME draw a box around
|
||||
}
|
||||
|
||||
// find the biggest entry in the current listing
|
||||
func (u *UI) biggestEntry() (biggest int64) {
|
||||
if u.d == nil {
|
||||
return
|
||||
}
|
||||
for i := range u.entries {
|
||||
size, _, _, _ := u.d.AttrI(u.sortPerm[i])
|
||||
if size > biggest {
|
||||
biggest = size
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Draw the current screen
|
||||
func (u *UI) Draw() error {
|
||||
w, h := termbox.Size()
|
||||
u.dirListHeight = h - 3
|
||||
|
||||
// Plot
|
||||
err := termbox.Clear(termbox.ColorDefault, termbox.ColorDefault)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to clear screen")
|
||||
}
|
||||
|
||||
// Header line
|
||||
Linef(0, 0, w, termbox.ColorBlack, termbox.ColorWhite, ' ', "rclone ncdu %s - use the arrow keys to navigate, press ? for help", fs.Version)
|
||||
|
||||
// Directory line
|
||||
Linef(0, 1, w, termbox.ColorWhite, termbox.ColorBlack, '-', "-- %s ", u.path)
|
||||
|
||||
// graphs
|
||||
const (
|
||||
graphBars = 10
|
||||
graph = "########## "
|
||||
)
|
||||
|
||||
// Directory listing
|
||||
if u.d != nil {
|
||||
y := 2
|
||||
perBar := u.biggestEntry() / graphBars
|
||||
if perBar == 0 {
|
||||
perBar = 1
|
||||
}
|
||||
dirPos := u.dirPosMap[u.path]
|
||||
for i, j := range u.sortPerm[dirPos.offset:] {
|
||||
entry := u.entries[j]
|
||||
n := i + dirPos.offset
|
||||
if y >= h-1 {
|
||||
break
|
||||
}
|
||||
fg := termbox.ColorWhite
|
||||
bg := termbox.ColorBlack
|
||||
if n == dirPos.entry {
|
||||
fg, bg = bg, fg
|
||||
}
|
||||
size, count, isDir, readable := u.d.AttrI(u.sortPerm[n])
|
||||
mark := ' '
|
||||
if isDir {
|
||||
mark = '/'
|
||||
}
|
||||
message := ""
|
||||
if !readable {
|
||||
message = " [not read yet]"
|
||||
}
|
||||
extras := ""
|
||||
if u.showCounts {
|
||||
if count > 0 {
|
||||
extras += fmt.Sprintf("%8v ", fs.SizeSuffix(count))
|
||||
} else {
|
||||
extras += " "
|
||||
}
|
||||
|
||||
}
|
||||
if u.showGraph {
|
||||
bars := (size + perBar/2 - 1) / perBar
|
||||
// clip if necessary - only happens during startup
|
||||
if bars > 10 {
|
||||
bars = 10
|
||||
} else if bars < 0 {
|
||||
bars = 0
|
||||
}
|
||||
extras += "[" + graph[graphBars-bars:2*graphBars-bars] + "] "
|
||||
}
|
||||
Linef(0, y, w, fg, bg, ' ', "%8v %s%c%s%s", fs.SizeSuffix(size), extras, mark, path.Base(entry.Remote()), message)
|
||||
y++
|
||||
}
|
||||
}
|
||||
|
||||
// Footer
|
||||
if u.d == nil {
|
||||
Line(0, h-1, w, termbox.ColorBlack, termbox.ColorWhite, ' ', "Waiting for root directory...")
|
||||
} else {
|
||||
message := ""
|
||||
if u.listing {
|
||||
message = " [listing in progress]"
|
||||
}
|
||||
size, count := u.d.Attr()
|
||||
Linef(0, h-1, w, termbox.ColorBlack, termbox.ColorWhite, ' ', "Total usage: %v, Objects: %d%s", fs.SizeSuffix(size), count, message)
|
||||
}
|
||||
|
||||
// Show the box on top if requred
|
||||
if u.showBox {
|
||||
u.Box()
|
||||
}
|
||||
err = termbox.Flush()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to flush screen")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Move the cursor this many spaces adjusting the viewport as necessary
|
||||
func (u *UI) move(d int) {
|
||||
if u.d == nil {
|
||||
return
|
||||
}
|
||||
|
||||
absD := d
|
||||
if d < 0 {
|
||||
absD = -d
|
||||
}
|
||||
|
||||
entries := len(u.entries)
|
||||
|
||||
// Fetch current dirPos
|
||||
dirPos := u.dirPosMap[u.path]
|
||||
|
||||
dirPos.entry += d
|
||||
|
||||
// check entry in range
|
||||
if dirPos.entry < 0 {
|
||||
dirPos.entry = 0
|
||||
} else if dirPos.entry >= entries {
|
||||
dirPos.entry = entries - 1
|
||||
}
|
||||
|
||||
// check cursor still on screen
|
||||
p := dirPos.entry - dirPos.offset // where dirPos.entry appears on the screen
|
||||
if p < 0 {
|
||||
dirPos.offset -= absD
|
||||
} else if p >= u.dirListHeight {
|
||||
dirPos.offset += absD
|
||||
}
|
||||
|
||||
// check dirPos.offset in bounds
|
||||
if dirPos.offset < 0 {
|
||||
dirPos.offset = 0
|
||||
} else if dirPos.offset >= entries {
|
||||
dirPos.offset = entries - 1
|
||||
}
|
||||
|
||||
// write dirPos back for later
|
||||
u.dirPosMap[u.path] = dirPos
|
||||
}
|
||||
|
||||
// Sort by the configured sort method
|
||||
type ncduSort struct {
|
||||
sortPerm []int
|
||||
entries fs.DirEntries
|
||||
d *scan.Dir
|
||||
u *UI
|
||||
}
|
||||
|
||||
// Less is part of sort.Interface.
|
||||
func (ds *ncduSort) Less(i, j int) bool {
|
||||
isize, icount, _, _ := ds.d.AttrI(ds.sortPerm[i])
|
||||
jsize, jcount, _, _ := ds.d.AttrI(ds.sortPerm[j])
|
||||
iname, jname := ds.entries[ds.sortPerm[i]].Remote(), ds.entries[ds.sortPerm[j]].Remote()
|
||||
switch {
|
||||
case ds.u.sortByName < 0:
|
||||
return iname > jname
|
||||
case ds.u.sortByName > 0:
|
||||
break
|
||||
case ds.u.sortBySize < 0:
|
||||
if isize != jsize {
|
||||
return isize < jsize
|
||||
}
|
||||
case ds.u.sortBySize > 0:
|
||||
if isize != jsize {
|
||||
return isize > jsize
|
||||
}
|
||||
case ds.u.sortByCount < 0:
|
||||
if icount != jcount {
|
||||
return icount < jcount
|
||||
}
|
||||
case ds.u.sortByCount > 0:
|
||||
if icount != jcount {
|
||||
return icount > jcount
|
||||
}
|
||||
}
|
||||
// if everything equal, sort by name
|
||||
return iname < jname
|
||||
}
|
||||
|
||||
// Swap is part of sort.Interface.
|
||||
func (ds *ncduSort) Swap(i, j int) {
|
||||
ds.sortPerm[i], ds.sortPerm[j] = ds.sortPerm[j], ds.sortPerm[i]
|
||||
}
|
||||
|
||||
// Len is part of sort.Interface.
|
||||
func (ds *ncduSort) Len() int {
|
||||
return len(ds.sortPerm)
|
||||
}
|
||||
|
||||
// sort the permutation map of the current directory
|
||||
func (u *UI) sortCurrentDir() {
|
||||
u.sortPerm = u.sortPerm[:0]
|
||||
for i := range u.entries {
|
||||
u.sortPerm = append(u.sortPerm, i)
|
||||
}
|
||||
data := ncduSort{
|
||||
sortPerm: u.sortPerm,
|
||||
entries: u.entries,
|
||||
d: u.d,
|
||||
u: u,
|
||||
}
|
||||
sort.Sort(&data)
|
||||
if len(u.invSortPerm) < len(u.sortPerm) {
|
||||
u.invSortPerm = make([]int, len(u.sortPerm))
|
||||
}
|
||||
for i, j := range u.sortPerm {
|
||||
u.invSortPerm[j] = i
|
||||
}
|
||||
}
|
||||
|
||||
// setCurrentDir sets the current directory
|
||||
func (u *UI) setCurrentDir(d *scan.Dir) {
|
||||
u.d = d
|
||||
u.entries = d.Entries()
|
||||
u.path = path.Join(u.fsName, d.Path())
|
||||
u.sortCurrentDir()
|
||||
}
|
||||
|
||||
// enters the current entry
|
||||
func (u *UI) enter() {
|
||||
if u.d == nil {
|
||||
return
|
||||
}
|
||||
dirPos := u.dirPosMap[u.path]
|
||||
d, _ := u.d.GetDir(u.sortPerm[dirPos.entry])
|
||||
if d == nil {
|
||||
return
|
||||
}
|
||||
u.setCurrentDir(d)
|
||||
}
|
||||
|
||||
// up goes up to the parent directory
|
||||
func (u *UI) up() {
|
||||
if u.d == nil {
|
||||
return
|
||||
}
|
||||
parent := u.d.Parent()
|
||||
if parent != nil {
|
||||
u.setCurrentDir(parent)
|
||||
}
|
||||
}
|
||||
|
||||
// popupBox shows a box with the text in
|
||||
func (u *UI) popupBox(text []string) {
|
||||
u.boxText = text
|
||||
u.showBox = true
|
||||
}
|
||||
|
||||
// togglePopupBox shows a box with the text in
|
||||
func (u *UI) togglePopupBox(text []string) {
|
||||
if u.showBox {
|
||||
u.showBox = false
|
||||
} else {
|
||||
u.popupBox(text)
|
||||
}
|
||||
}
|
||||
|
||||
// toggle the sorting for the flag passed in
|
||||
func (u *UI) toggleSort(sortType *int8) {
|
||||
old := *sortType
|
||||
u.sortBySize = 0
|
||||
u.sortByCount = 0
|
||||
u.sortByName = 0
|
||||
if old == 0 {
|
||||
*sortType = 1
|
||||
} else {
|
||||
*sortType = -old
|
||||
}
|
||||
u.sortCurrentDir()
|
||||
}
|
||||
|
||||
// NewUI creates a new user interface for ncdu on f
|
||||
func NewUI(f fs.Fs) *UI {
|
||||
return &UI{
|
||||
f: f,
|
||||
path: "Waiting for root...",
|
||||
dirListHeight: 20, // updated in Draw
|
||||
fsName: f.Name() + ":" + f.Root(),
|
||||
showGraph: true,
|
||||
showCounts: false,
|
||||
sortByName: 0, // +1 for normal, 0 for off, -1 for reverse
|
||||
sortBySize: 1,
|
||||
sortByCount: 0,
|
||||
dirPosMap: make(map[string]dirPos),
|
||||
}
|
||||
}
|
||||
|
||||
// Show shows the user interface
|
||||
func (u *UI) Show() error {
|
||||
err := termbox.Init()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer termbox.Close()
|
||||
|
||||
// scan the disk in the background
|
||||
u.listing = true
|
||||
rootChan, errChan, updated := scan.Scan(u.f)
|
||||
|
||||
// Poll the events into a channel
|
||||
events := make(chan termbox.Event)
|
||||
doneWithEvent := make(chan bool)
|
||||
go func() {
|
||||
for {
|
||||
events <- termbox.PollEvent()
|
||||
<-doneWithEvent
|
||||
}
|
||||
}()
|
||||
|
||||
// Main loop, waiting for events and channels
|
||||
outer:
|
||||
for {
|
||||
//Reset()
|
||||
err := u.Draw()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "draw failed")
|
||||
}
|
||||
var root *scan.Dir
|
||||
select {
|
||||
case root = <-rootChan:
|
||||
u.root = root
|
||||
u.setCurrentDir(root)
|
||||
case err := <-errChan:
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "ncdu directory listing")
|
||||
}
|
||||
u.listing = false
|
||||
case <-updated:
|
||||
// redraw
|
||||
// might want to limit updates per second
|
||||
u.sortCurrentDir()
|
||||
case ev := <-events:
|
||||
doneWithEvent <- true
|
||||
if ev.Type == termbox.EventKey {
|
||||
switch ev.Key + termbox.Key(ev.Ch) {
|
||||
case termbox.KeyEsc, termbox.KeyCtrlC, 'q':
|
||||
if u.showBox {
|
||||
u.showBox = false
|
||||
} else {
|
||||
break outer
|
||||
}
|
||||
case termbox.KeyArrowDown, 'j':
|
||||
u.move(1)
|
||||
case termbox.KeyArrowUp, 'k':
|
||||
u.move(-1)
|
||||
case termbox.KeyPgdn, '-', '_':
|
||||
u.move(u.dirListHeight)
|
||||
case termbox.KeyPgup, '=', '+':
|
||||
u.move(-u.dirListHeight)
|
||||
case termbox.KeyArrowLeft, 'h':
|
||||
u.up()
|
||||
case termbox.KeyArrowRight, 'l', termbox.KeyEnter:
|
||||
u.enter()
|
||||
case 'c':
|
||||
u.showCounts = !u.showCounts
|
||||
case 'g':
|
||||
u.showGraph = !u.showGraph
|
||||
case 'n':
|
||||
u.toggleSort(&u.sortByName)
|
||||
case 's':
|
||||
u.toggleSort(&u.sortBySize)
|
||||
case 'C':
|
||||
u.toggleSort(&u.sortByCount)
|
||||
case '?':
|
||||
u.togglePopupBox(helpText)
|
||||
}
|
||||
}
|
||||
}
|
||||
// listen to key presses, etc
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// Build for ncdu for unsupported platforms to stop go complaining
|
||||
// about "no buildable Go source files "
|
||||
|
||||
// +build plan9 solaris
|
||||
|
||||
package ncdu
|
||||
@@ -0,0 +1,167 @@
|
||||
// Package scan does concurrent scanning of an Fs building up a directory tree.
|
||||
package scan
|
||||
|
||||
import (
|
||||
"path"
|
||||
"sync"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Dir represents a directory found in the remote
|
||||
type Dir struct {
|
||||
parent *Dir
|
||||
path string
|
||||
mu sync.Mutex
|
||||
count int64
|
||||
size int64
|
||||
complete bool
|
||||
entries fs.DirEntries
|
||||
dirs map[string]*Dir
|
||||
offset int // current listing offset
|
||||
entry int // current listing entry
|
||||
}
|
||||
|
||||
// Parent returns the directory above this one
|
||||
func (d *Dir) Parent() *Dir {
|
||||
// no locking needed since these are write once in newDir()
|
||||
return d.parent
|
||||
}
|
||||
|
||||
// Path returns the position of the dir in the filesystem
|
||||
func (d *Dir) Path() string {
|
||||
// no locking needed since these are write once in newDir()
|
||||
return d.path
|
||||
}
|
||||
|
||||
// make a new directory
|
||||
func newDir(parent *Dir, dirPath string, entries fs.DirEntries) *Dir {
|
||||
d := &Dir{
|
||||
parent: parent,
|
||||
path: dirPath,
|
||||
entries: entries,
|
||||
dirs: make(map[string]*Dir),
|
||||
}
|
||||
// Count size in this dir
|
||||
for _, entry := range entries {
|
||||
if o, ok := entry.(fs.Object); ok {
|
||||
d.count++
|
||||
d.size += o.Size()
|
||||
}
|
||||
}
|
||||
// Set my directory entry in parent
|
||||
if parent != nil {
|
||||
parent.mu.Lock()
|
||||
leaf := path.Base(dirPath)
|
||||
d.parent.dirs[leaf] = d
|
||||
parent.mu.Unlock()
|
||||
}
|
||||
// Accumulate counts in parents
|
||||
for ; parent != nil; parent = parent.parent {
|
||||
parent.mu.Lock()
|
||||
parent.count += d.count
|
||||
parent.size += d.size
|
||||
parent.mu.Unlock()
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// Entries returns a copy of the entries in the directory
|
||||
func (d *Dir) Entries() fs.DirEntries {
|
||||
return append(fs.DirEntries(nil), d.entries...)
|
||||
}
|
||||
|
||||
// gets the directory of the i-th entry
|
||||
//
|
||||
// returns nil if it is a file
|
||||
// returns a flag as to whether is directory or not
|
||||
//
|
||||
// Call with d.mu held
|
||||
func (d *Dir) getDir(i int) (subDir *Dir, isDir bool) {
|
||||
obj := d.entries[i]
|
||||
dir, ok := obj.(fs.Directory)
|
||||
if !ok {
|
||||
return nil, false
|
||||
}
|
||||
leaf := path.Base(dir.Remote())
|
||||
subDir = d.dirs[leaf]
|
||||
return subDir, true
|
||||
}
|
||||
|
||||
// GetDir returns the Dir of the i-th entry
|
||||
//
|
||||
// returns nil if it is a file
|
||||
// returns a flag as to whether is directory or not
|
||||
func (d *Dir) GetDir(i int) (subDir *Dir, isDir bool) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
return d.getDir(i)
|
||||
}
|
||||
|
||||
// Attr returns the size and count for the directory
|
||||
func (d *Dir) Attr() (size int64, count int64) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
return d.size, d.count
|
||||
}
|
||||
|
||||
// AttrI returns the size, count and flags for the i-th directory entry
|
||||
func (d *Dir) AttrI(i int) (size int64, count int64, isDir bool, readable bool) {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
subDir, isDir := d.getDir(i)
|
||||
if !isDir {
|
||||
return d.entries[i].Size(), 0, false, true
|
||||
}
|
||||
if subDir == nil {
|
||||
return 0, 0, true, false
|
||||
}
|
||||
size, count = subDir.Attr()
|
||||
return size, count, true, true
|
||||
}
|
||||
|
||||
// Scan the Fs passed in, returning a root directory channel and an
|
||||
// error channel
|
||||
func Scan(f fs.Fs) (chan *Dir, chan error, chan struct{}) {
|
||||
root := make(chan *Dir, 1)
|
||||
errChan := make(chan error, 1)
|
||||
updated := make(chan struct{}, 1)
|
||||
go func() {
|
||||
parents := map[string]*Dir{}
|
||||
err := fs.Walk(f, "", false, fs.Config.MaxDepth, func(dirPath string, entries fs.DirEntries, err error) error {
|
||||
if err != nil {
|
||||
return err // FIXME mark directory as errored instead of aborting
|
||||
}
|
||||
var parent *Dir
|
||||
if dirPath != "" {
|
||||
parentPath := path.Dir(dirPath)
|
||||
if parentPath == "." {
|
||||
parentPath = ""
|
||||
}
|
||||
var ok bool
|
||||
parent, ok = parents[parentPath]
|
||||
if !ok {
|
||||
errChan <- errors.Errorf("couldn't find parent for %q", dirPath)
|
||||
}
|
||||
}
|
||||
d := newDir(parent, dirPath, entries)
|
||||
parents[dirPath] = d
|
||||
if dirPath == "" {
|
||||
root <- d
|
||||
}
|
||||
// Mark updated
|
||||
select {
|
||||
case updated <- struct{}{}:
|
||||
default:
|
||||
break
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
errChan <- errors.Wrap(err, "ncdu listing failed")
|
||||
}
|
||||
errChan <- nil
|
||||
}()
|
||||
return root, errChan, updated
|
||||
}
|
||||
@@ -12,7 +12,7 @@ func init() {
|
||||
|
||||
var rmdirsCmd = &cobra.Command{
|
||||
Use: "rmdirs remote:path",
|
||||
Short: `Remove any empty directoryies under the path.`,
|
||||
Short: `Remove empty directories under the path.`,
|
||||
Long: `This removes any empty directories (or directories that only contain
|
||||
empty directories) under the path that it finds, including the path if
|
||||
it has nothing in.
|
||||
|
||||
+192
-2
@@ -8,6 +8,7 @@ import (
|
||||
"encoding/base32"
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"unicode/utf8"
|
||||
@@ -49,6 +50,7 @@ var (
|
||||
ErrorNotAnEncryptedFile = errors.New("not an encrypted file - no \"" + encryptedSuffix + "\" suffix")
|
||||
ErrorBadSeek = errors.New("Seek beyond end of file")
|
||||
defaultSalt = []byte{0xA8, 0x0D, 0xF4, 0x3A, 0x8F, 0xBD, 0x03, 0x08, 0xA7, 0xCA, 0xB8, 0x3E, 0x58, 0x1F, 0x86, 0xB1}
|
||||
obfuscQuoteRune = '!'
|
||||
)
|
||||
|
||||
// Global variables
|
||||
@@ -95,6 +97,7 @@ type NameEncryptionMode int
|
||||
const (
|
||||
NameEncryptionOff NameEncryptionMode = iota
|
||||
NameEncryptionStandard
|
||||
NameEncryptionObfuscated
|
||||
)
|
||||
|
||||
// NewNameEncryptionMode turns a string into a NameEncryptionMode
|
||||
@@ -105,6 +108,8 @@ func NewNameEncryptionMode(s string) (mode NameEncryptionMode, err error) {
|
||||
mode = NameEncryptionOff
|
||||
case "standard":
|
||||
mode = NameEncryptionStandard
|
||||
case "obfuscate":
|
||||
mode = NameEncryptionObfuscated
|
||||
default:
|
||||
err = errors.Errorf("Unknown file name encryption mode %q", s)
|
||||
}
|
||||
@@ -118,6 +123,8 @@ func (mode NameEncryptionMode) String() (out string) {
|
||||
out = "off"
|
||||
case NameEncryptionStandard:
|
||||
out = "standard"
|
||||
case NameEncryptionObfuscated:
|
||||
out = "obfuscate"
|
||||
default:
|
||||
out = fmt.Sprintf("Unknown mode #%d", mode)
|
||||
}
|
||||
@@ -284,11 +291,189 @@ func (c *cipher) decryptSegment(ciphertext string) (string, error) {
|
||||
return string(plaintext), err
|
||||
}
|
||||
|
||||
// Simple obfuscation routines
|
||||
func (c *cipher) obfuscateSegment(plaintext string) string {
|
||||
if plaintext == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
// If the string isn't valid UTF8 then don't rotate; just
|
||||
// prepend a !.
|
||||
if !utf8.ValidString(plaintext) {
|
||||
return "!." + plaintext
|
||||
}
|
||||
|
||||
// Calculate a simple rotation based on the filename and
|
||||
// the nameKey
|
||||
var dir int
|
||||
for _, runeValue := range plaintext {
|
||||
dir += int(runeValue)
|
||||
}
|
||||
dir = dir % 256
|
||||
|
||||
// We'll use this number to store in the result filename...
|
||||
var result bytes.Buffer
|
||||
_, _ = result.WriteString(strconv.Itoa(dir) + ".")
|
||||
|
||||
// but we'll augment it with the nameKey for real calculation
|
||||
for i := 0; i < len(c.nameKey); i++ {
|
||||
dir += int(c.nameKey[i])
|
||||
}
|
||||
|
||||
// Now for each character, depending on the range it is in
|
||||
// we will actually rotate a different amount
|
||||
for _, runeValue := range plaintext {
|
||||
switch {
|
||||
case runeValue == obfuscQuoteRune:
|
||||
// Quote the Quote character
|
||||
_, _ = result.WriteRune(obfuscQuoteRune)
|
||||
_, _ = result.WriteRune(obfuscQuoteRune)
|
||||
|
||||
case runeValue >= '0' && runeValue <= '9':
|
||||
// Number
|
||||
thisdir := (dir % 9) + 1
|
||||
newRune := '0' + (int(runeValue)-'0'+thisdir)%10
|
||||
_, _ = result.WriteRune(rune(newRune))
|
||||
|
||||
case (runeValue >= 'A' && runeValue <= 'Z') ||
|
||||
(runeValue >= 'a' && runeValue <= 'z'):
|
||||
// ASCII letter. Try to avoid trivial A->a mappings
|
||||
thisdir := dir%25 + 1
|
||||
// Calculate the offset of this character in A-Za-z
|
||||
pos := int(runeValue - 'A')
|
||||
if pos >= 26 {
|
||||
pos -= 6 // It's lower case
|
||||
}
|
||||
// Rotate the character to the new location
|
||||
pos = (pos + thisdir) % 52
|
||||
if pos >= 26 {
|
||||
pos += 6 // and handle lower case offset again
|
||||
}
|
||||
_, _ = result.WriteRune(rune('A' + pos))
|
||||
|
||||
case runeValue >= 0xA0 && runeValue <= 0xFF:
|
||||
// Latin 1 supplement
|
||||
thisdir := (dir % 95) + 1
|
||||
newRune := 0xA0 + (int(runeValue)-0xA0+thisdir)%96
|
||||
_, _ = result.WriteRune(rune(newRune))
|
||||
|
||||
case runeValue >= 0x100:
|
||||
// Some random Unicode range; we have no good rules here
|
||||
thisdir := (dir % 127) + 1
|
||||
base := int(runeValue - runeValue%256)
|
||||
newRune := rune(base + (int(runeValue)-base+thisdir)%256)
|
||||
// If the new character isn't a valid UTF8 char
|
||||
// then don't rotate it. Quote it instead
|
||||
if !utf8.ValidRune(newRune) {
|
||||
_, _ = result.WriteRune(obfuscQuoteRune)
|
||||
_, _ = result.WriteRune(runeValue)
|
||||
} else {
|
||||
_, _ = result.WriteRune(newRune)
|
||||
}
|
||||
|
||||
default:
|
||||
// Leave character untouched
|
||||
_, _ = result.WriteRune(runeValue)
|
||||
}
|
||||
}
|
||||
return result.String()
|
||||
}
|
||||
|
||||
func (c *cipher) deobfuscateSegment(ciphertext string) (string, error) {
|
||||
if ciphertext == "" {
|
||||
return "", nil
|
||||
}
|
||||
pos := strings.Index(ciphertext, ".")
|
||||
if pos == -1 {
|
||||
return "", ErrorNotAnEncryptedFile
|
||||
} // No .
|
||||
num := ciphertext[:pos]
|
||||
if num == "!" {
|
||||
// No rotation; probably original was not valid unicode
|
||||
return ciphertext[pos+1:], nil
|
||||
}
|
||||
dir, err := strconv.Atoi(num)
|
||||
if err != nil {
|
||||
return "", ErrorNotAnEncryptedFile // Not a number
|
||||
}
|
||||
|
||||
// add the nameKey to get the real rotate distance
|
||||
for i := 0; i < len(c.nameKey); i++ {
|
||||
dir += int(c.nameKey[i])
|
||||
}
|
||||
|
||||
var result bytes.Buffer
|
||||
|
||||
inQuote := false
|
||||
for _, runeValue := range ciphertext[pos+1:] {
|
||||
switch {
|
||||
case inQuote:
|
||||
_, _ = result.WriteRune(runeValue)
|
||||
inQuote = false
|
||||
|
||||
case runeValue == obfuscQuoteRune:
|
||||
inQuote = true
|
||||
|
||||
case runeValue >= '0' && runeValue <= '9':
|
||||
// Number
|
||||
thisdir := (dir % 9) + 1
|
||||
newRune := '0' + int(runeValue) - '0' - thisdir
|
||||
if newRune < '0' {
|
||||
newRune += 10
|
||||
}
|
||||
_, _ = result.WriteRune(rune(newRune))
|
||||
|
||||
case (runeValue >= 'A' && runeValue <= 'Z') ||
|
||||
(runeValue >= 'a' && runeValue <= 'z'):
|
||||
thisdir := dir%25 + 1
|
||||
pos := int(runeValue - 'A')
|
||||
if pos >= 26 {
|
||||
pos -= 6
|
||||
}
|
||||
pos = pos - thisdir
|
||||
if pos < 0 {
|
||||
pos += 52
|
||||
}
|
||||
if pos >= 26 {
|
||||
pos += 6
|
||||
}
|
||||
_, _ = result.WriteRune(rune('A' + pos))
|
||||
|
||||
case runeValue >= 0xA0 && runeValue <= 0xFF:
|
||||
thisdir := (dir % 95) + 1
|
||||
newRune := 0xA0 + int(runeValue) - 0xA0 - thisdir
|
||||
if newRune < 0xA0 {
|
||||
newRune += 96
|
||||
}
|
||||
_, _ = result.WriteRune(rune(newRune))
|
||||
|
||||
case runeValue >= 0x100:
|
||||
thisdir := (dir % 127) + 1
|
||||
base := int(runeValue - runeValue%256)
|
||||
newRune := rune(base + (int(runeValue) - base - thisdir))
|
||||
if int(newRune) < base {
|
||||
newRune += 256
|
||||
}
|
||||
_, _ = result.WriteRune(rune(newRune))
|
||||
|
||||
default:
|
||||
_, _ = result.WriteRune(runeValue)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return result.String(), nil
|
||||
}
|
||||
|
||||
// encryptFileName encrypts a file path
|
||||
func (c *cipher) encryptFileName(in string) string {
|
||||
segments := strings.Split(in, "/")
|
||||
for i := range segments {
|
||||
segments[i] = c.encryptSegment(segments[i])
|
||||
if c.mode == NameEncryptionStandard {
|
||||
segments[i] = c.encryptSegment(segments[i])
|
||||
} else {
|
||||
segments[i] = c.obfuscateSegment(segments[i])
|
||||
}
|
||||
}
|
||||
return strings.Join(segments, "/")
|
||||
}
|
||||
@@ -314,7 +499,12 @@ func (c *cipher) decryptFileName(in string) (string, error) {
|
||||
segments := strings.Split(in, "/")
|
||||
for i := range segments {
|
||||
var err error
|
||||
segments[i], err = c.decryptSegment(segments[i])
|
||||
if c.mode == NameEncryptionStandard {
|
||||
segments[i], err = c.decryptSegment(segments[i])
|
||||
} else {
|
||||
segments[i], err = c.deobfuscateSegment(segments[i])
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
+35
-3
@@ -23,6 +23,7 @@ func TestNewNameEncryptionMode(t *testing.T) {
|
||||
}{
|
||||
{"off", NameEncryptionOff, ""},
|
||||
{"standard", NameEncryptionStandard, ""},
|
||||
{"obfuscate", NameEncryptionObfuscated, ""},
|
||||
{"potato", NameEncryptionMode(0), "Unknown file name encryption mode \"potato\""},
|
||||
} {
|
||||
actual, actualErr := NewNameEncryptionMode(test.in)
|
||||
@@ -38,7 +39,8 @@ func TestNewNameEncryptionMode(t *testing.T) {
|
||||
func TestNewNameEncryptionModeString(t *testing.T) {
|
||||
assert.Equal(t, NameEncryptionOff.String(), "off")
|
||||
assert.Equal(t, NameEncryptionStandard.String(), "standard")
|
||||
assert.Equal(t, NameEncryptionMode(2).String(), "Unknown mode #2")
|
||||
assert.Equal(t, NameEncryptionObfuscated.String(), "obfuscate")
|
||||
assert.Equal(t, NameEncryptionMode(3).String(), "Unknown mode #3")
|
||||
}
|
||||
|
||||
func TestValidString(t *testing.T) {
|
||||
@@ -84,7 +86,7 @@ func TestValidString(t *testing.T) {
|
||||
{"£100", nil},
|
||||
{`hello? sausage/êé/Hello, 世界/ " ' @ < > & ?/z.txt`, nil},
|
||||
{"£100", nil},
|
||||
// Following tests from http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php#54805
|
||||
// Following tests from https://secure.php.net/manual/en/reference.pcre.pattern.modifiers.php#54805
|
||||
{"a", nil}, // Valid ASCII
|
||||
{"\xc3\xb1", nil}, // Valid 2 Octet Sequence
|
||||
{"\xc3\x28", ErrorBadDecryptUTF8}, // Invalid 2 Octet Sequence
|
||||
@@ -219,6 +221,11 @@ func TestEncryptFileName(t *testing.T) {
|
||||
// Now off mode
|
||||
c, _ = newCipher(NameEncryptionOff, "", "")
|
||||
assert.Equal(t, "1/12/123.bin", c.EncryptFileName("1/12/123"))
|
||||
// Obfuscation mode
|
||||
c, _ = newCipher(NameEncryptionObfuscated, "", "")
|
||||
assert.Equal(t, "49.6/99.23/150.890/53.!!lipps", c.EncryptFileName("1/12/123/!hello"))
|
||||
assert.Equal(t, "161.\u00e4", c.EncryptFileName("\u00a1"))
|
||||
assert.Equal(t, "160.\u03c2", c.EncryptFileName("\u03a0"))
|
||||
}
|
||||
|
||||
func TestDecryptFileName(t *testing.T) {
|
||||
@@ -236,6 +243,10 @@ func TestDecryptFileName(t *testing.T) {
|
||||
{NameEncryptionOff, "1/12/123.bin", "1/12/123", nil},
|
||||
{NameEncryptionOff, "1/12/123.bix", "", ErrorNotAnEncryptedFile},
|
||||
{NameEncryptionOff, ".bin", "", ErrorNotAnEncryptedFile},
|
||||
{NameEncryptionObfuscated, "!.hello", "hello", nil},
|
||||
{NameEncryptionObfuscated, "hello", "", ErrorNotAnEncryptedFile},
|
||||
{NameEncryptionObfuscated, "161.\u00e4", "\u00a1", nil},
|
||||
{NameEncryptionObfuscated, "160.\u03c2", "\u03a0", nil},
|
||||
} {
|
||||
c, _ := newCipher(test.mode, "", "")
|
||||
actual, actualErr := c.DecryptFileName(test.in)
|
||||
@@ -245,6 +256,24 @@ func TestDecryptFileName(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncDecMatches(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
mode NameEncryptionMode
|
||||
in string
|
||||
}{
|
||||
{NameEncryptionStandard, "1/2/3/4"},
|
||||
{NameEncryptionOff, "1/2/3/4"},
|
||||
{NameEncryptionObfuscated, "1/2/3/4/!hello\u03a0"},
|
||||
{NameEncryptionObfuscated, "Avatar The Last Airbender"},
|
||||
} {
|
||||
c, _ := newCipher(test.mode, "", "")
|
||||
out, err := c.DecryptFileName(c.EncryptFileName(test.in))
|
||||
what := fmt.Sprintf("Testing %q (mode=%v)", test.in, test.mode)
|
||||
assert.Equal(t, out, test.in, what)
|
||||
assert.Equal(t, err, nil, what)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncryptDirName(t *testing.T) {
|
||||
// First standard mode
|
||||
c, _ := newCipher(NameEncryptionStandard, "", "")
|
||||
@@ -660,7 +689,7 @@ func TestRandomSource(t *testing.T) {
|
||||
buf := make([]byte, 16)
|
||||
_, _ = source.Read(buf)
|
||||
sink = newRandomSource(1E8)
|
||||
n, err = io.Copy(sink, source)
|
||||
_, err = io.Copy(sink, source)
|
||||
assert.Error(t, err, "Error in stream")
|
||||
}
|
||||
|
||||
@@ -937,6 +966,7 @@ func TestNewDecrypterSeek(t *testing.T) {
|
||||
|
||||
// Now try decoding it with a single open and lots of seeks
|
||||
rc, err := c.DecryptDataSeek(open, 0)
|
||||
assert.NoError(t, err)
|
||||
for _, offset := range trials {
|
||||
_, err := rc.Seek(int64(offset), 0)
|
||||
assert.NoError(t, err)
|
||||
@@ -1021,6 +1051,7 @@ func TestDecrypterClose(t *testing.T) {
|
||||
// close before reading
|
||||
assert.Equal(t, nil, fh.err)
|
||||
err = fh.Close()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, ErrorFileClosed, fh.err)
|
||||
assert.Equal(t, 1, cd.closed)
|
||||
|
||||
@@ -1041,6 +1072,7 @@ func TestDecrypterClose(t *testing.T) {
|
||||
assert.Equal(t, []byte{1}, out)
|
||||
assert.Equal(t, io.EOF, fh.err)
|
||||
err = fh.Close()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, ErrorFileClosed, fh.err)
|
||||
assert.Equal(t, 1, cd.closed)
|
||||
}
|
||||
|
||||
+98
-92
@@ -6,7 +6,6 @@ import (
|
||||
"io"
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/pkg/errors"
|
||||
@@ -37,6 +36,9 @@ func init() {
|
||||
}, {
|
||||
Value: "standard",
|
||||
Help: "Encrypt the filenames see the docs for the details.",
|
||||
}, {
|
||||
Value: "obfuscate",
|
||||
Help: "Very simple filename obfuscation.",
|
||||
},
|
||||
},
|
||||
}, {
|
||||
@@ -137,12 +139,94 @@ func (f *Fs) Features() *fs.Features {
|
||||
|
||||
// String returns a description of the FS
|
||||
func (f *Fs) String() string {
|
||||
return fmt.Sprintf("Encrypted %s", f.Fs.String())
|
||||
return fmt.Sprintf("Encrypted drive '%s:%s'", f.name, f.root)
|
||||
}
|
||||
|
||||
// List the Fs into a channel
|
||||
func (f *Fs) List(opts fs.ListOpts, dir string) {
|
||||
f.Fs.List(f.newListOpts(opts, dir), f.cipher.EncryptDirName(dir))
|
||||
// Encrypt an object file name to entries.
|
||||
func (f *Fs) add(entries *fs.DirEntries, obj fs.Object) {
|
||||
remote := obj.Remote()
|
||||
decryptedRemote, err := f.cipher.DecryptFileName(remote)
|
||||
if err != nil {
|
||||
fs.Debugf(remote, "Skipping undecryptable file name: %v", err)
|
||||
return
|
||||
}
|
||||
if *cryptShowMapping {
|
||||
fs.Logf(decryptedRemote, "Encrypts to %q", remote)
|
||||
}
|
||||
*entries = append(*entries, f.newObject(obj))
|
||||
}
|
||||
|
||||
// Encrypt an directory file name to entries.
|
||||
func (f *Fs) addDir(entries *fs.DirEntries, dir fs.Directory) {
|
||||
remote := dir.Remote()
|
||||
decryptedRemote, err := f.cipher.DecryptDirName(remote)
|
||||
if err != nil {
|
||||
fs.Debugf(remote, "Skipping undecryptable dir name: %v", err)
|
||||
return
|
||||
}
|
||||
if *cryptShowMapping {
|
||||
fs.Logf(decryptedRemote, "Encrypts to %q", remote)
|
||||
}
|
||||
*entries = append(*entries, f.newDir(dir))
|
||||
}
|
||||
|
||||
// Encrypt some directory entries. This alters entries returning it as newEntries.
|
||||
func (f *Fs) encryptEntries(entries fs.DirEntries) (newEntries fs.DirEntries, err error) {
|
||||
newEntries = entries[:0] // in place filter
|
||||
for _, entry := range entries {
|
||||
switch x := entry.(type) {
|
||||
case fs.Object:
|
||||
f.add(&newEntries, x)
|
||||
case fs.Directory:
|
||||
f.addDir(&newEntries, x)
|
||||
default:
|
||||
return nil, errors.Errorf("Unknown object type %T", entry)
|
||||
}
|
||||
}
|
||||
return newEntries, nil
|
||||
}
|
||||
|
||||
// List the objects and directories in dir into entries. The
|
||||
// entries can be returned in any order but should be for a
|
||||
// complete directory.
|
||||
//
|
||||
// dir should be "" to list the root, and should not have
|
||||
// trailing slashes.
|
||||
//
|
||||
// This should return ErrDirNotFound if the directory isn't
|
||||
// found.
|
||||
func (f *Fs) List(dir string) (entries fs.DirEntries, err error) {
|
||||
entries, err = f.Fs.List(f.cipher.EncryptDirName(dir))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return f.encryptEntries(entries)
|
||||
}
|
||||
|
||||
// ListR lists the objects and directories of the Fs starting
|
||||
// from dir recursively into out.
|
||||
//
|
||||
// dir should be "" to start from the root, and should not
|
||||
// have trailing slashes.
|
||||
//
|
||||
// This should return ErrDirNotFound if the directory isn't
|
||||
// found.
|
||||
//
|
||||
// It should call callback for each tranche of entries read.
|
||||
// These need not be returned in any particular order. If
|
||||
// callback returns an error then the listing will stop
|
||||
// immediately.
|
||||
//
|
||||
// Don't implement this unless you have a more efficient way
|
||||
// of listing recursively that doing a directory traversal.
|
||||
func (f *Fs) ListR(dir string, callback fs.ListRCallback) (err error) {
|
||||
return f.Fs.Features().ListR(f.cipher.EncryptDirName(dir), func(entries fs.DirEntries) error {
|
||||
newEntries, err := f.encryptEntries(entries)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return callback(newEntries)
|
||||
})
|
||||
}
|
||||
|
||||
// NewObject finds the Object at remote.
|
||||
@@ -159,7 +243,7 @@ func (f *Fs) NewObject(remote string) (fs.Object, error) {
|
||||
// May create the object even if it returns an error - if so
|
||||
// will return the object and the error, otherwise will return
|
||||
// nil and the error
|
||||
func (f *Fs) Put(in io.Reader, src fs.ObjectInfo) (fs.Object, error) {
|
||||
func (f *Fs) Put(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
|
||||
wrappedIn, err := f.cipher.EncryptData(in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -279,7 +363,7 @@ func (f *Fs) DirMove(src fs.Fs, srcRemote, dstRemote string) error {
|
||||
//
|
||||
// This will create a duplicate if we upload a new file without
|
||||
// checking to see if there is one already - use Put() for that.
|
||||
func (f *Fs) PutUnchecked(in io.Reader, src fs.ObjectInfo) (fs.Object, error) {
|
||||
func (f *Fs) PutUnchecked(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
|
||||
do := f.Fs.Features().PutUnchecked
|
||||
if do == nil {
|
||||
return nil, errors.New("can't PutUnchecked")
|
||||
@@ -452,7 +536,7 @@ func (o *Object) Open(options ...fs.OpenOption) (rc io.ReadCloser, err error) {
|
||||
}
|
||||
|
||||
// Update in to the object with the modTime given of the given size
|
||||
func (o *Object) Update(in io.Reader, src fs.ObjectInfo) error {
|
||||
func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error {
|
||||
wrappedIn, err := o.f.cipher.EncryptData(in)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -461,16 +545,16 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo) error {
|
||||
}
|
||||
|
||||
// newDir returns a dir with the Name decrypted
|
||||
func (f *Fs) newDir(dir *fs.Dir) *fs.Dir {
|
||||
new := *dir
|
||||
remote := dir.Name
|
||||
func (f *Fs) newDir(dir fs.Directory) fs.Directory {
|
||||
new := fs.NewDirCopy(dir)
|
||||
remote := dir.Remote()
|
||||
decryptedRemote, err := f.cipher.DecryptDirName(remote)
|
||||
if err != nil {
|
||||
fs.Debugf(remote, "Undecryptable dir name: %v", err)
|
||||
} else {
|
||||
new.Name = decryptedRemote
|
||||
new.SetRemote(decryptedRemote)
|
||||
}
|
||||
return &new
|
||||
return new
|
||||
}
|
||||
|
||||
// ObjectInfo describes a wrapped fs.ObjectInfo for being the source
|
||||
@@ -509,84 +593,6 @@ func (o *ObjectInfo) Hash(hash fs.HashType) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// ListOpts wraps a listopts decrypting the directory listing and
|
||||
// replacing the Objects
|
||||
type ListOpts struct {
|
||||
fs.ListOpts
|
||||
f *Fs
|
||||
dir string // dir we are listing
|
||||
mu sync.Mutex // to protect dirs
|
||||
dirs map[string]struct{} // keep track of synthetic directory objects added
|
||||
}
|
||||
|
||||
// Make a ListOpts wrapper
|
||||
func (f *Fs) newListOpts(lo fs.ListOpts, dir string) *ListOpts {
|
||||
if dir != "" {
|
||||
dir += "/"
|
||||
}
|
||||
return &ListOpts{
|
||||
ListOpts: lo,
|
||||
f: f,
|
||||
dir: dir,
|
||||
dirs: make(map[string]struct{}),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Level gets the recursion level for this listing.
|
||||
//
|
||||
// Fses may ignore this, but should implement it for improved efficiency if possible.
|
||||
//
|
||||
// Level 1 means list just the contents of the directory
|
||||
//
|
||||
// Each returned item must have less than level `/`s in.
|
||||
func (lo *ListOpts) Level() int {
|
||||
return lo.ListOpts.Level()
|
||||
}
|
||||
|
||||
// Add an object to the output.
|
||||
// If the function returns true, the operation has been aborted.
|
||||
// Multiple goroutines can safely add objects concurrently.
|
||||
func (lo *ListOpts) Add(obj fs.Object) (abort bool) {
|
||||
remote := obj.Remote()
|
||||
decryptedRemote, err := lo.f.cipher.DecryptFileName(remote)
|
||||
if err != nil {
|
||||
fs.Debugf(remote, "Skipping undecryptable file name: %v", err)
|
||||
return lo.ListOpts.IsFinished()
|
||||
}
|
||||
if *cryptShowMapping {
|
||||
fs.Logf(decryptedRemote, "Encrypts to %q", remote)
|
||||
}
|
||||
return lo.ListOpts.Add(lo.f.newObject(obj))
|
||||
}
|
||||
|
||||
// AddDir adds a directory to the output.
|
||||
// If the function returns true, the operation has been aborted.
|
||||
// Multiple goroutines can safely add objects concurrently.
|
||||
func (lo *ListOpts) AddDir(dir *fs.Dir) (abort bool) {
|
||||
remote := dir.Name
|
||||
decryptedRemote, err := lo.f.cipher.DecryptDirName(remote)
|
||||
if err != nil {
|
||||
fs.Debugf(remote, "Skipping undecryptable dir name: %v", err)
|
||||
return lo.ListOpts.IsFinished()
|
||||
}
|
||||
if *cryptShowMapping {
|
||||
fs.Logf(decryptedRemote, "Encrypts to %q", remote)
|
||||
}
|
||||
return lo.ListOpts.AddDir(lo.f.newDir(dir))
|
||||
}
|
||||
|
||||
// IncludeDirectory returns whether this directory should be
|
||||
// included in the listing (and recursed into or not).
|
||||
func (lo *ListOpts) IncludeDirectory(remote string) bool {
|
||||
decryptedRemote, err := lo.f.cipher.DecryptDirName(remote)
|
||||
if err != nil {
|
||||
fs.Debugf(remote, "Not including undecryptable directory name: %v", err)
|
||||
return false
|
||||
}
|
||||
return lo.ListOpts.IncludeDirectory(decryptedRemote)
|
||||
}
|
||||
|
||||
// Check the interfaces are satisfied
|
||||
var (
|
||||
_ fs.Fs = (*Fs)(nil)
|
||||
@@ -597,7 +603,7 @@ var (
|
||||
_ fs.PutUncheckeder = (*Fs)(nil)
|
||||
_ fs.CleanUpper = (*Fs)(nil)
|
||||
_ fs.UnWrapper = (*Fs)(nil)
|
||||
_ fs.ListRer = (*Fs)(nil)
|
||||
_ fs.ObjectInfo = (*ObjectInfo)(nil)
|
||||
_ fs.Object = (*Object)(nil)
|
||||
_ fs.ListOpts = (*ListOpts)(nil)
|
||||
)
|
||||
+10
-1
@@ -21,30 +21,38 @@ func TestSetup2(t *testing.T) {
|
||||
// Generic tests for the Fs
|
||||
func TestInit2(t *testing.T) { fstests.TestInit(t) }
|
||||
func TestFsString2(t *testing.T) { fstests.TestFsString(t) }
|
||||
func TestFsName2(t *testing.T) { fstests.TestFsName(t) }
|
||||
func TestFsRoot2(t *testing.T) { fstests.TestFsRoot(t) }
|
||||
func TestFsRmdirEmpty2(t *testing.T) { fstests.TestFsRmdirEmpty(t) }
|
||||
func TestFsRmdirNotFound2(t *testing.T) { fstests.TestFsRmdirNotFound(t) }
|
||||
func TestFsMkdir2(t *testing.T) { fstests.TestFsMkdir(t) }
|
||||
func TestFsMkdirRmdirSubdir2(t *testing.T) { fstests.TestFsMkdirRmdirSubdir(t) }
|
||||
func TestFsListEmpty2(t *testing.T) { fstests.TestFsListEmpty(t) }
|
||||
func TestFsListDirEmpty2(t *testing.T) { fstests.TestFsListDirEmpty(t) }
|
||||
func TestFsListRDirEmpty2(t *testing.T) { fstests.TestFsListRDirEmpty(t) }
|
||||
func TestFsNewObjectNotFound2(t *testing.T) { fstests.TestFsNewObjectNotFound(t) }
|
||||
func TestFsPutFile12(t *testing.T) { fstests.TestFsPutFile1(t) }
|
||||
func TestFsPutError2(t *testing.T) { fstests.TestFsPutError(t) }
|
||||
func TestFsPutFile22(t *testing.T) { fstests.TestFsPutFile2(t) }
|
||||
func TestFsUpdateFile12(t *testing.T) { fstests.TestFsUpdateFile1(t) }
|
||||
func TestFsListDirFile22(t *testing.T) { fstests.TestFsListDirFile2(t) }
|
||||
func TestFsListRDirFile22(t *testing.T) { fstests.TestFsListRDirFile2(t) }
|
||||
func TestFsListDirRoot2(t *testing.T) { fstests.TestFsListDirRoot(t) }
|
||||
func TestFsListRDirRoot2(t *testing.T) { fstests.TestFsListRDirRoot(t) }
|
||||
func TestFsListSubdir2(t *testing.T) { fstests.TestFsListSubdir(t) }
|
||||
func TestFsListRSubdir2(t *testing.T) { fstests.TestFsListRSubdir(t) }
|
||||
func TestFsListLevel22(t *testing.T) { fstests.TestFsListLevel2(t) }
|
||||
func TestFsListRLevel22(t *testing.T) { fstests.TestFsListRLevel2(t) }
|
||||
func TestFsListFile12(t *testing.T) { fstests.TestFsListFile1(t) }
|
||||
func TestFsNewObject2(t *testing.T) { fstests.TestFsNewObject(t) }
|
||||
func TestFsNewObjectDir2(t *testing.T) { fstests.TestFsNewObjectDir(t) }
|
||||
func TestFsListFile1and22(t *testing.T) { fstests.TestFsListFile1and2(t) }
|
||||
func TestFsNewObjectDir2(t *testing.T) { fstests.TestFsNewObjectDir(t) }
|
||||
func TestFsCopy2(t *testing.T) { fstests.TestFsCopy(t) }
|
||||
func TestFsMove2(t *testing.T) { fstests.TestFsMove(t) }
|
||||
func TestFsDirMove2(t *testing.T) { fstests.TestFsDirMove(t) }
|
||||
func TestFsRmdirFull2(t *testing.T) { fstests.TestFsRmdirFull(t) }
|
||||
func TestFsPrecision2(t *testing.T) { fstests.TestFsPrecision(t) }
|
||||
func TestFsDirChangeNotify2(t *testing.T) { fstests.TestFsDirChangeNotify(t) }
|
||||
func TestObjectString2(t *testing.T) { fstests.TestObjectString(t) }
|
||||
func TestObjectFs2(t *testing.T) { fstests.TestObjectFs(t) }
|
||||
func TestObjectRemote2(t *testing.T) { fstests.TestObjectRemote(t) }
|
||||
@@ -55,6 +63,7 @@ func TestObjectSetModTime2(t *testing.T) { fstests.TestObjectSetModTime(t) }
|
||||
func TestObjectSize2(t *testing.T) { fstests.TestObjectSize(t) }
|
||||
func TestObjectOpen2(t *testing.T) { fstests.TestObjectOpen(t) }
|
||||
func TestObjectOpenSeek2(t *testing.T) { fstests.TestObjectOpenSeek(t) }
|
||||
func TestObjectPartialRead2(t *testing.T) { fstests.TestObjectPartialRead(t) }
|
||||
func TestObjectUpdate2(t *testing.T) { fstests.TestObjectUpdate(t) }
|
||||
func TestObjectStorable2(t *testing.T) { fstests.TestObjectStorable(t) }
|
||||
func TestFsIsFile2(t *testing.T) { fstests.TestFsIsFile(t) }
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
// Test Crypt filesystem interface
|
||||
//
|
||||
// Automatically generated - DO NOT EDIT
|
||||
// Regenerate with: make gen_tests
|
||||
package crypt_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ncw/rclone/crypt"
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/ncw/rclone/fstest/fstests"
|
||||
_ "github.com/ncw/rclone/local"
|
||||
)
|
||||
|
||||
func TestSetup3(t *testing.T) {
|
||||
fstests.NilObject = fs.Object((*crypt.Object)(nil))
|
||||
fstests.RemoteName = "TestCrypt3:"
|
||||
}
|
||||
|
||||
// Generic tests for the Fs
|
||||
func TestInit3(t *testing.T) { fstests.TestInit(t) }
|
||||
func TestFsString3(t *testing.T) { fstests.TestFsString(t) }
|
||||
func TestFsName3(t *testing.T) { fstests.TestFsName(t) }
|
||||
func TestFsRoot3(t *testing.T) { fstests.TestFsRoot(t) }
|
||||
func TestFsRmdirEmpty3(t *testing.T) { fstests.TestFsRmdirEmpty(t) }
|
||||
func TestFsRmdirNotFound3(t *testing.T) { fstests.TestFsRmdirNotFound(t) }
|
||||
func TestFsMkdir3(t *testing.T) { fstests.TestFsMkdir(t) }
|
||||
func TestFsMkdirRmdirSubdir3(t *testing.T) { fstests.TestFsMkdirRmdirSubdir(t) }
|
||||
func TestFsListEmpty3(t *testing.T) { fstests.TestFsListEmpty(t) }
|
||||
func TestFsListDirEmpty3(t *testing.T) { fstests.TestFsListDirEmpty(t) }
|
||||
func TestFsListRDirEmpty3(t *testing.T) { fstests.TestFsListRDirEmpty(t) }
|
||||
func TestFsNewObjectNotFound3(t *testing.T) { fstests.TestFsNewObjectNotFound(t) }
|
||||
func TestFsPutFile13(t *testing.T) { fstests.TestFsPutFile1(t) }
|
||||
func TestFsPutError3(t *testing.T) { fstests.TestFsPutError(t) }
|
||||
func TestFsPutFile23(t *testing.T) { fstests.TestFsPutFile2(t) }
|
||||
func TestFsUpdateFile13(t *testing.T) { fstests.TestFsUpdateFile1(t) }
|
||||
func TestFsListDirFile23(t *testing.T) { fstests.TestFsListDirFile2(t) }
|
||||
func TestFsListRDirFile23(t *testing.T) { fstests.TestFsListRDirFile2(t) }
|
||||
func TestFsListDirRoot3(t *testing.T) { fstests.TestFsListDirRoot(t) }
|
||||
func TestFsListRDirRoot3(t *testing.T) { fstests.TestFsListRDirRoot(t) }
|
||||
func TestFsListSubdir3(t *testing.T) { fstests.TestFsListSubdir(t) }
|
||||
func TestFsListRSubdir3(t *testing.T) { fstests.TestFsListRSubdir(t) }
|
||||
func TestFsListLevel23(t *testing.T) { fstests.TestFsListLevel2(t) }
|
||||
func TestFsListRLevel23(t *testing.T) { fstests.TestFsListRLevel2(t) }
|
||||
func TestFsListFile13(t *testing.T) { fstests.TestFsListFile1(t) }
|
||||
func TestFsNewObject3(t *testing.T) { fstests.TestFsNewObject(t) }
|
||||
func TestFsListFile1and23(t *testing.T) { fstests.TestFsListFile1and2(t) }
|
||||
func TestFsNewObjectDir3(t *testing.T) { fstests.TestFsNewObjectDir(t) }
|
||||
func TestFsCopy3(t *testing.T) { fstests.TestFsCopy(t) }
|
||||
func TestFsMove3(t *testing.T) { fstests.TestFsMove(t) }
|
||||
func TestFsDirMove3(t *testing.T) { fstests.TestFsDirMove(t) }
|
||||
func TestFsRmdirFull3(t *testing.T) { fstests.TestFsRmdirFull(t) }
|
||||
func TestFsPrecision3(t *testing.T) { fstests.TestFsPrecision(t) }
|
||||
func TestFsDirChangeNotify3(t *testing.T) { fstests.TestFsDirChangeNotify(t) }
|
||||
func TestObjectString3(t *testing.T) { fstests.TestObjectString(t) }
|
||||
func TestObjectFs3(t *testing.T) { fstests.TestObjectFs(t) }
|
||||
func TestObjectRemote3(t *testing.T) { fstests.TestObjectRemote(t) }
|
||||
func TestObjectHashes3(t *testing.T) { fstests.TestObjectHashes(t) }
|
||||
func TestObjectModTime3(t *testing.T) { fstests.TestObjectModTime(t) }
|
||||
func TestObjectMimeType3(t *testing.T) { fstests.TestObjectMimeType(t) }
|
||||
func TestObjectSetModTime3(t *testing.T) { fstests.TestObjectSetModTime(t) }
|
||||
func TestObjectSize3(t *testing.T) { fstests.TestObjectSize(t) }
|
||||
func TestObjectOpen3(t *testing.T) { fstests.TestObjectOpen(t) }
|
||||
func TestObjectOpenSeek3(t *testing.T) { fstests.TestObjectOpenSeek(t) }
|
||||
func TestObjectPartialRead3(t *testing.T) { fstests.TestObjectPartialRead(t) }
|
||||
func TestObjectUpdate3(t *testing.T) { fstests.TestObjectUpdate(t) }
|
||||
func TestObjectStorable3(t *testing.T) { fstests.TestObjectStorable(t) }
|
||||
func TestFsIsFile3(t *testing.T) { fstests.TestFsIsFile(t) }
|
||||
func TestFsIsFileNotFound3(t *testing.T) { fstests.TestFsIsFileNotFound(t) }
|
||||
func TestObjectRemove3(t *testing.T) { fstests.TestObjectRemove(t) }
|
||||
func TestObjectPurge3(t *testing.T) { fstests.TestObjectPurge(t) }
|
||||
func TestFinalise3(t *testing.T) { fstests.TestFinalise(t) }
|
||||
@@ -14,6 +14,8 @@ func init() {
|
||||
name := "TestCrypt"
|
||||
tempdir2 := filepath.Join(os.TempDir(), "rclone-crypt-test-off")
|
||||
name2 := name + "2"
|
||||
tempdir3 := filepath.Join(os.TempDir(), "rclone-crypt-test-obfuscate")
|
||||
name3 := name + "3"
|
||||
fstests.ExtraConfig = []fstests.ExtraConfigItem{
|
||||
{Name: name, Key: "type", Value: "crypt"},
|
||||
{Name: name, Key: "remote", Value: tempdir},
|
||||
@@ -23,5 +25,10 @@ func init() {
|
||||
{Name: name2, Key: "remote", Value: tempdir2},
|
||||
{Name: name2, Key: "password", Value: fs.MustObscure("potato2")},
|
||||
{Name: name2, Key: "filename_encryption", Value: "off"},
|
||||
{Name: name3, Key: "type", Value: "crypt"},
|
||||
{Name: name3, Key: "remote", Value: tempdir3},
|
||||
{Name: name3, Key: "password", Value: fs.MustObscure("potato2")},
|
||||
{Name: name3, Key: "filename_encryption", Value: "obfuscate"},
|
||||
}
|
||||
fstests.SkipBadWindowsCharacters[name3+":"] = true
|
||||
}
|
||||
+10
-1
@@ -21,30 +21,38 @@ func TestSetup(t *testing.T) {
|
||||
// Generic tests for the Fs
|
||||
func TestInit(t *testing.T) { fstests.TestInit(t) }
|
||||
func TestFsString(t *testing.T) { fstests.TestFsString(t) }
|
||||
func TestFsName(t *testing.T) { fstests.TestFsName(t) }
|
||||
func TestFsRoot(t *testing.T) { fstests.TestFsRoot(t) }
|
||||
func TestFsRmdirEmpty(t *testing.T) { fstests.TestFsRmdirEmpty(t) }
|
||||
func TestFsRmdirNotFound(t *testing.T) { fstests.TestFsRmdirNotFound(t) }
|
||||
func TestFsMkdir(t *testing.T) { fstests.TestFsMkdir(t) }
|
||||
func TestFsMkdirRmdirSubdir(t *testing.T) { fstests.TestFsMkdirRmdirSubdir(t) }
|
||||
func TestFsListEmpty(t *testing.T) { fstests.TestFsListEmpty(t) }
|
||||
func TestFsListDirEmpty(t *testing.T) { fstests.TestFsListDirEmpty(t) }
|
||||
func TestFsListRDirEmpty(t *testing.T) { fstests.TestFsListRDirEmpty(t) }
|
||||
func TestFsNewObjectNotFound(t *testing.T) { fstests.TestFsNewObjectNotFound(t) }
|
||||
func TestFsPutFile1(t *testing.T) { fstests.TestFsPutFile1(t) }
|
||||
func TestFsPutError(t *testing.T) { fstests.TestFsPutError(t) }
|
||||
func TestFsPutFile2(t *testing.T) { fstests.TestFsPutFile2(t) }
|
||||
func TestFsUpdateFile1(t *testing.T) { fstests.TestFsUpdateFile1(t) }
|
||||
func TestFsListDirFile2(t *testing.T) { fstests.TestFsListDirFile2(t) }
|
||||
func TestFsListRDirFile2(t *testing.T) { fstests.TestFsListRDirFile2(t) }
|
||||
func TestFsListDirRoot(t *testing.T) { fstests.TestFsListDirRoot(t) }
|
||||
func TestFsListRDirRoot(t *testing.T) { fstests.TestFsListRDirRoot(t) }
|
||||
func TestFsListSubdir(t *testing.T) { fstests.TestFsListSubdir(t) }
|
||||
func TestFsListRSubdir(t *testing.T) { fstests.TestFsListRSubdir(t) }
|
||||
func TestFsListLevel2(t *testing.T) { fstests.TestFsListLevel2(t) }
|
||||
func TestFsListRLevel2(t *testing.T) { fstests.TestFsListRLevel2(t) }
|
||||
func TestFsListFile1(t *testing.T) { fstests.TestFsListFile1(t) }
|
||||
func TestFsNewObject(t *testing.T) { fstests.TestFsNewObject(t) }
|
||||
func TestFsNewObjectDir(t *testing.T) { fstests.TestFsNewObjectDir(t) }
|
||||
func TestFsListFile1and2(t *testing.T) { fstests.TestFsListFile1and2(t) }
|
||||
func TestFsNewObjectDir(t *testing.T) { fstests.TestFsNewObjectDir(t) }
|
||||
func TestFsCopy(t *testing.T) { fstests.TestFsCopy(t) }
|
||||
func TestFsMove(t *testing.T) { fstests.TestFsMove(t) }
|
||||
func TestFsDirMove(t *testing.T) { fstests.TestFsDirMove(t) }
|
||||
func TestFsRmdirFull(t *testing.T) { fstests.TestFsRmdirFull(t) }
|
||||
func TestFsPrecision(t *testing.T) { fstests.TestFsPrecision(t) }
|
||||
func TestFsDirChangeNotify(t *testing.T) { fstests.TestFsDirChangeNotify(t) }
|
||||
func TestObjectString(t *testing.T) { fstests.TestObjectString(t) }
|
||||
func TestObjectFs(t *testing.T) { fstests.TestObjectFs(t) }
|
||||
func TestObjectRemote(t *testing.T) { fstests.TestObjectRemote(t) }
|
||||
@@ -55,6 +63,7 @@ func TestObjectSetModTime(t *testing.T) { fstests.TestObjectSetModTime(t) }
|
||||
func TestObjectSize(t *testing.T) { fstests.TestObjectSize(t) }
|
||||
func TestObjectOpen(t *testing.T) { fstests.TestObjectOpen(t) }
|
||||
func TestObjectOpenSeek(t *testing.T) { fstests.TestObjectOpenSeek(t) }
|
||||
func TestObjectPartialRead(t *testing.T) { fstests.TestObjectPartialRead(t) }
|
||||
func TestObjectUpdate(t *testing.T) { fstests.TestObjectUpdate(t) }
|
||||
func TestObjectStorable(t *testing.T) { fstests.TestObjectStorable(t) }
|
||||
func TestFsIsFile(t *testing.T) { fstests.TestFsIsFile(t) }
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
// Listing utility functions for fses which use dircache
|
||||
|
||||
package dircache
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
)
|
||||
|
||||
// ListDirJob describe a directory listing that needs to be done
|
||||
type ListDirJob struct {
|
||||
DirID string
|
||||
Path string
|
||||
Depth int
|
||||
}
|
||||
|
||||
// ListDirer describes the interface necessary to use ListDir
|
||||
type ListDirer interface {
|
||||
// ListDir reads the directory specified by the job into out, returning any more jobs
|
||||
ListDir(out fs.ListOpts, job ListDirJob) (jobs []ListDirJob, err error)
|
||||
}
|
||||
|
||||
// listDir lists the directory using a recursive list from the root
|
||||
//
|
||||
// It does this in parallel, calling f.ListDir to do the actual reading
|
||||
func listDir(f ListDirer, out fs.ListOpts, dirID string, path string) {
|
||||
// Start some directory listing go routines
|
||||
var wg sync.WaitGroup // sync closing of go routines
|
||||
var traversing sync.WaitGroup // running directory traversals
|
||||
buffer := out.Buffer()
|
||||
in := make(chan ListDirJob, buffer)
|
||||
for i := 0; i < buffer; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for job := range in {
|
||||
jobs, err := f.ListDir(out, job)
|
||||
if err != nil {
|
||||
out.SetError(err)
|
||||
fs.Debugf(f, "Error reading %s: %s", path, err)
|
||||
} else {
|
||||
traversing.Add(len(jobs))
|
||||
go func() {
|
||||
// Now we have traversed this directory, send these
|
||||
// jobs off for traversal in the background
|
||||
for _, job := range jobs {
|
||||
in <- job
|
||||
}
|
||||
}()
|
||||
}
|
||||
traversing.Done()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// Start the process
|
||||
traversing.Add(1)
|
||||
in <- ListDirJob{DirID: dirID, Path: path, Depth: out.Level() - 1}
|
||||
traversing.Wait()
|
||||
close(in)
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
// List walks the path returning iles and directories into out
|
||||
func (dc *DirCache) List(f ListDirer, out fs.ListOpts, dir string) {
|
||||
defer out.Finished()
|
||||
err := dc.FindRoot(false)
|
||||
if err != nil {
|
||||
out.SetError(err)
|
||||
return
|
||||
}
|
||||
id, err := dc.FindDir(dir, false)
|
||||
if err != nil {
|
||||
out.SetError(err)
|
||||
return
|
||||
}
|
||||
if dir != "" {
|
||||
dir += "/"
|
||||
}
|
||||
listDir(f, out, id, dir)
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"group": "groups",
|
||||
"menu": "menu"
|
||||
},
|
||||
"baseurl": "http://rclone.org",
|
||||
"baseurl": "https://rclone.org",
|
||||
"title": "rclone - rsync for cloud storage",
|
||||
"description": "rclone - rsync for cloud storage: google drive, s3, swift, cloudfiles, dropbox, memstore...",
|
||||
"canonifyurls": false,
|
||||
|
||||
@@ -9,7 +9,7 @@ groups: ["about"]
|
||||
Rclone
|
||||
======
|
||||
|
||||
[](http://rclone.org/)
|
||||
[](https://rclone.org/)
|
||||
|
||||
Rclone is a command line program to sync files and directories to and from
|
||||
|
||||
@@ -19,11 +19,13 @@ Rclone is a command line program to sync files and directories to and from
|
||||
* Dropbox
|
||||
* Google Cloud Storage
|
||||
* Amazon Drive
|
||||
* Microsoft One Drive
|
||||
* Microsoft OneDrive
|
||||
* Hubic
|
||||
* Backblaze B2
|
||||
* Yandex Disk
|
||||
* SFTP
|
||||
* FTP
|
||||
* HTTP
|
||||
* The local filesystem
|
||||
|
||||
Features
|
||||
@@ -40,8 +42,8 @@ Features
|
||||
|
||||
Links
|
||||
|
||||
* <i class="fa fa-home"></i> [Home page](http://rclone.org/)
|
||||
* <i class="fa fa-github"></i> [Github project page for source and bug tracker](http://github.com/ncw/rclone)
|
||||
* <i class="fa fa-home"></i> [Home page](https://rclone.org/)
|
||||
* <i class="fa fa-github"></i> [Github project page for source and bug tracker](https://github.com/ncw/rclone)
|
||||
* <i class="fa fa-comments"></i> [Rclone Forum](https://forum.rclone.org)
|
||||
* <i class="fa fa-google-plus"></i> <a href="https://google.com/+RcloneOrg" rel="publisher">Google+ page</a>
|
||||
* <i class="fa fa-cloud-download"></i>[Downloads](/downloads/)
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: "Amazon Drive"
|
||||
description: "Rclone docs for Amazon Drive"
|
||||
date: "2016-07-11"
|
||||
date: "2017-06-10"
|
||||
---
|
||||
|
||||
<i class="fa fa-amazon"></i> Amazon Drive
|
||||
@@ -15,6 +15,26 @@ The initial setup for Amazon Drive involves getting a token from
|
||||
Amazon which you need to do in your browser. `rclone config` walks
|
||||
you through it.
|
||||
|
||||
The configuration process for Amazon Drive may involve using an [oauth
|
||||
proxy](https://github.com/ncw/oauthproxy). This is used to keep the
|
||||
Amazon credentials out of the source code. The proxy runs in Google's
|
||||
very secure App Engine environment and doesn't store any credentials
|
||||
which pass through it.
|
||||
|
||||
**NB** rclone doesn't not currently have its own Amazon Drive
|
||||
credentials (see [the
|
||||
forum](https://forum.rclone.org/t/rclone-has-been-banned-from-amazon-drive/)
|
||||
for why) so you will either need to have your own `client_id` and
|
||||
`client_secret` with Amazon Drive, or use a a third party ouath proxy
|
||||
in which case you will need to enter `client_id`, `client_secret`,
|
||||
`auth_url` and `token_url`.
|
||||
|
||||
Note also if you are not using Amazon's `auth_url` and `token_url`,
|
||||
(ie you filled in something for those) then if setting up on a remote
|
||||
machine you can only use the [copying the config method of
|
||||
configuration](https://rclone.org/remote_setup/#configuring-by-copying-the-config-file)
|
||||
- `rclone authorize` will not work.
|
||||
|
||||
Here is an example of how to make a remote called `remote`. First run:
|
||||
|
||||
rclone config
|
||||
@@ -22,10 +42,13 @@ Here is an example of how to make a remote called `remote`. First run:
|
||||
This will guide you through an interactive setup process:
|
||||
|
||||
```
|
||||
No remotes found - make a new one
|
||||
n) New remote
|
||||
d) Delete remote
|
||||
r) Rename remote
|
||||
c) Copy remote
|
||||
s) Set configuration password
|
||||
q) Quit config
|
||||
e/n/d/q> n
|
||||
n/r/c/s/q> n
|
||||
name> remote
|
||||
Type of storage to configure.
|
||||
Choose a number from below, or type in your own value
|
||||
@@ -39,28 +62,35 @@ Choose a number from below, or type in your own value
|
||||
\ "dropbox"
|
||||
5 / Encrypt/Decrypt a remote
|
||||
\ "crypt"
|
||||
6 / Google Cloud Storage (this is not Google Drive)
|
||||
6 / FTP Connection
|
||||
\ "ftp"
|
||||
7 / Google Cloud Storage (this is not Google Drive)
|
||||
\ "google cloud storage"
|
||||
7 / Google Drive
|
||||
8 / Google Drive
|
||||
\ "drive"
|
||||
8 / Hubic
|
||||
9 / Hubic
|
||||
\ "hubic"
|
||||
9 / Local Disk
|
||||
10 / Local Disk
|
||||
\ "local"
|
||||
10 / Microsoft OneDrive
|
||||
11 / Microsoft OneDrive
|
||||
\ "onedrive"
|
||||
11 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
|
||||
12 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
|
||||
\ "swift"
|
||||
12 / SSH/SFTP Connection
|
||||
13 / SSH/SFTP Connection
|
||||
\ "sftp"
|
||||
13 / Yandex Disk
|
||||
14 / Yandex Disk
|
||||
\ "yandex"
|
||||
Storage> 1
|
||||
Amazon Application Client Id - leave blank normally.
|
||||
client_id>
|
||||
Amazon Application Client Secret - leave blank normally.
|
||||
client_secret>
|
||||
Amazon Application Client Id - required.
|
||||
client_id> your client ID goes here
|
||||
Amazon Application Client Secret - required.
|
||||
client_secret> your client secret goes here
|
||||
Auth server URL - leave blank to use Amazon's.
|
||||
auth_url> Optional auth URL
|
||||
Token server url - leave blank to use Amazon's.
|
||||
token_url> Optional token URL
|
||||
Remote config
|
||||
Make sure your Redirect URL is set to "http://127.0.0.1:53682/" in your custom config.
|
||||
Use auto config?
|
||||
* Say Y if not sure
|
||||
* Say N if you are working on a remote or headless machine
|
||||
@@ -73,8 +103,10 @@ Waiting for code...
|
||||
Got code
|
||||
--------------------
|
||||
[remote]
|
||||
client_id =
|
||||
client_secret =
|
||||
client_id = your client ID goes here
|
||||
client_secret = your client secret goes here
|
||||
auth_url = Optional auth URL
|
||||
token_url = Optional token URL
|
||||
token = {"access_token":"xxxxxxxxxxxxxxxxxxxxxxx","token_type":"bearer","refresh_token":"xxxxxxxxxxxxxxxxxx","expiry":"2015-09-06T16:07:39.658438471+01:00"}
|
||||
--------------------
|
||||
y) Yes this is OK
|
||||
@@ -183,7 +215,7 @@ larger than this will fail.
|
||||
At the time of writing (Jan 2016) is in the area of 50GB per file.
|
||||
This means that larger files are likely to fail.
|
||||
|
||||
Unfortunatly there is no way for rclone to see that this failure is
|
||||
Unfortunately there is no way for rclone to see that this failure is
|
||||
because of file size, so it will retry the operation, as any other
|
||||
failure. To avoid this problem, use `--max-size 50000M` option to limit
|
||||
the maximum size of uploaded files. Note that `--max-size` does not split
|
||||
|
||||
+28
-1
@@ -13,7 +13,7 @@ Contributors
|
||||
------------
|
||||
|
||||
* Alex Couper <amcouper@gmail.com>
|
||||
* Leonid Shalupov <leonid@shalupov.com>
|
||||
* Leonid Shalupov <leonid@shalupov.com> <shalupov@diverse.org.ru>
|
||||
* Shimon Doodkin <helpmepro1@gmail.com>
|
||||
* Colin Nicholson <colin@colinn.com>
|
||||
* Klaus Post <klauspost@gmail.com>
|
||||
@@ -61,3 +61,30 @@ Contributors
|
||||
* Jack Schmidt <github@mowsey.org>
|
||||
* Dedsec1 <Dedsec1@users.noreply.github.com>
|
||||
* Hisham Zarka <hzarka@gmail.com>
|
||||
* Jérôme Vizcaino <jerome.vizcaino@gmail.com>
|
||||
* Mike Tesch <mjt6129@rit.edu>
|
||||
* Marvin Watson <marvwatson@users.noreply.github.com>
|
||||
* Danny Tsai <danny8376@gmail.com>
|
||||
* Yoni Jah <yonjah+git@gmail.com> <yonjah+github@gmail.com>
|
||||
* Stephen Harris <github@spuddy.org>
|
||||
* Ihor Dvoretskyi <ihor.dvoretskyi@gmail.com>
|
||||
* Jon Craton <jncraton@gmail.com>
|
||||
* Hraban Luyat <hraban@0brg.net>
|
||||
* Michael Ledin <mledin89@gmail.com>
|
||||
* Martin Kristensen <me@azgul.com>
|
||||
* Too Much IO <toomuchio@users.noreply.github.com>
|
||||
* Anisse Astier <anisse@astier.eu>
|
||||
* Zahiar Ahmed <zahiar@live.com>
|
||||
* Igor Kharin <igorkharin@gmail.com>
|
||||
* Bill Zissimopoulos <billziss@navimatics.com>
|
||||
* Bob Potter <bobby.potter@gmail.com>
|
||||
* Steven Lu <tacticalazn@gmail.com>
|
||||
* Sjur Fredriksen <sjurtf@ifi.uio.no>
|
||||
* Ruwbin <hubus12345@gmail.com>
|
||||
* Fabian Möller <fabianm88@gmail.com>
|
||||
* Edward Q. Bridges <github@eqbridges.com>
|
||||
* Vasiliy Tolstov <v.tolstov@selfip.ru>
|
||||
* Harshavardhana <harsha@minio.io>
|
||||
* sainaen <sainaen@gmail.com>
|
||||
* gdm85 <gdm85@users.noreply.github.com>
|
||||
* Yaroslav Halchenko <debian@onerussian.com>
|
||||
+7
-1
@@ -93,6 +93,12 @@ excess files in the bucket.
|
||||
|
||||
rclone sync /home/local/directory remote:bucket
|
||||
|
||||
### --fast-list ###
|
||||
|
||||
This remote supports `--fast-list` which allows you to use fewer
|
||||
transactions in exchange for more memory. See the [rclone
|
||||
docs](/docs/#fast-list) for more details.
|
||||
|
||||
### Modified time ###
|
||||
|
||||
The modified time is stored as metadata on the object as
|
||||
@@ -242,7 +248,7 @@ system.
|
||||
|
||||
When uploading large files chunk the file into this size. Note that
|
||||
these chunks are buffered in memory and there might a maximum of
|
||||
`--transfers` chunks in progress at once. 100,000,000 Bytes is the
|
||||
`--transfers` chunks in progress at once. 5,000,000 Bytes is the
|
||||
minimim size (default 96M).
|
||||
|
||||
#### --b2-upload-cutoff=SIZE ####
|
||||
|
||||
+107
-4
@@ -1,12 +1,115 @@
|
||||
---
|
||||
title: "Documentation"
|
||||
description: "Rclone Changelog"
|
||||
date: "2016-11-06"
|
||||
date: "2017-07-22"
|
||||
---
|
||||
|
||||
Changelog
|
||||
---------
|
||||
|
||||
* v1.37 - 2017-07-22
|
||||
* New backends
|
||||
* FTP - thanks to Antonio Messina
|
||||
* HTTP - thanks to Vasiliy Tolstov
|
||||
* New commands
|
||||
* rclone ncdu - for exploring a remote with a text based user interface.
|
||||
* rclone lsjson - for listing with a machine readable output
|
||||
* rclone dbhashsum - to show Dropbox style hashes of files (local or Dropbox)
|
||||
* New Features
|
||||
* Implement --fast-list flag
|
||||
* This allows remotes to list recursively if they can
|
||||
* This uses less transactions (important if you pay for them)
|
||||
* This may or may not be quicker
|
||||
* This will user more memory as it has to hold the listing in memory
|
||||
* --old-sync-method deprecated - the remaining uses are covered by --fast-list
|
||||
* This involved a major re-write of all the listing code
|
||||
* Add --tpslimit and --tpslimit-burst to limit transactions per second
|
||||
* this is useful in conjuction with `rclone mount` to limit external apps
|
||||
* Add --stats-log-level so can see --stats without -v
|
||||
* Print password prompts to stderr - Hraban Luyat
|
||||
* Warn about duplicate files when syncing
|
||||
* Oauth improvements
|
||||
* allow auth_url and token_url to be set in the config file
|
||||
* Print redirection URI if using own credentials.
|
||||
* Don't Mkdir at the start of sync to save transactions
|
||||
* Compile
|
||||
* Update build to go1.8.3
|
||||
* Require go1.6 for building rclone
|
||||
* Compile 386 builds with "GO386=387" for maximum compatibility
|
||||
* Bug Fixes
|
||||
* Fix menu selection when no remotes
|
||||
* Config saving reworked to not kill the file if disk gets full
|
||||
* Don't delete remote if name does not change while renaming
|
||||
* moveto, copyto: report transfers and checks as per move and copy
|
||||
* Local
|
||||
* Add --local-no-unicode-normalization flag - Bob Potter
|
||||
* Mount
|
||||
* Now supported on Windows using cgofuse and WinFsp - thanks to Bill Zissimopoulos for much help
|
||||
* Compare checksums on upload/download via FUSE
|
||||
* Unmount when program ends with SIGINT (Ctrl+C) or SIGTERM - Jérôme Vizcaino
|
||||
* On read only open of file, make open pending until first read
|
||||
* Make --read-only reject modify operations
|
||||
* Implement ModTime via FUSE for remotes that support it
|
||||
* Allow modTime to be changed even before all writers are closed
|
||||
* Fix panic on renames
|
||||
* Fix hang on errored upload
|
||||
* Crypt
|
||||
* Report the name:root as specified by the user
|
||||
* Add an "obfuscate" option for filename encryption - Stephen Harris
|
||||
* Amazon Drive
|
||||
* Fix initialization order for token renewer
|
||||
* Remove revoked credentials, allow oauth proxy config and update docs
|
||||
* B2
|
||||
* Reduce minimum chunk size to 5MB
|
||||
* Drive
|
||||
* Add team drive support
|
||||
* Reduce bandwidth by adding fields for partial responses - Martin Kristensen
|
||||
* Implement --drive-shared-with-me flag to view shared with me files - Danny Tsai
|
||||
* Add --drive-trashed-only to read only the files in the trash
|
||||
* Remove obsolete --drive-full-list
|
||||
* Add missing seek to start on retries of chunked uploads
|
||||
* Fix stats accounting for upload
|
||||
* Convert / in names to a unicode equivalent (/)
|
||||
* Poll for Google Drive changes when mounted
|
||||
* OneDrive
|
||||
* Fix the uploading of files with spaces
|
||||
* Fix initialization order for token renewer
|
||||
* Display speeds accurately when uploading - Yoni Jah
|
||||
* Swap to using http://localhost:53682/ as redirect URL - Michael Ledin
|
||||
* Retry on token expired error, reset upload body on retry - Yoni Jah
|
||||
* Google Cloud Storage
|
||||
* Add ability to specify location and storage class via config and command line - thanks gdm85
|
||||
* Create container if necessary on server side copy
|
||||
* Increase directory listing chunk to 1000 to increase performance
|
||||
* Obtain a refresh token for GCS - Steven Lu
|
||||
* Yandex
|
||||
* Fix the name reported in log messages (was empty)
|
||||
* Correct error return for listing empty directory
|
||||
* Dropbox
|
||||
* Rewritten to use the v2 API
|
||||
* Now supports ModTime
|
||||
* Can only set by uploading the file again
|
||||
* If you uploaded with an old rclone, rclone may upload everything again
|
||||
* Use `--size-only` or `--checksum` to avoid this
|
||||
* Now supports the Dropbox content hashing scheme
|
||||
* Now supports low level retries
|
||||
* S3
|
||||
* Work around eventual consistency in bucket creation
|
||||
* Create container if necessary on server side copy
|
||||
* Add us-east-2 (Ohio) and eu-west-2 (London) S3 regions - Zahiar Ahmed
|
||||
* Swift, Hubic
|
||||
* Fix zero length directory markers showing in the subdirectory listing
|
||||
* this caused lots of duplicate transfers
|
||||
* Fix paged directory listings
|
||||
* this caused duplicate directory errors
|
||||
* Create container if necessary on server side copy
|
||||
* Increase directory listing chunk to 1000 to increase performance
|
||||
* Make sensible error if the user forgets the container
|
||||
* SFTP
|
||||
* Add support for using ssh key files
|
||||
* Fix under Windows
|
||||
* Fix ssh agent on Windows
|
||||
* Adapt to latest version of library - Igor Kharin
|
||||
* v1.36 - 2017-03-18
|
||||
* New Features
|
||||
* SFTP remote (Jack Schmidt)
|
||||
@@ -391,7 +494,7 @@ Changelog
|
||||
* Upload releases to github too
|
||||
* Swift
|
||||
* Fix sync for chunked files
|
||||
* One Drive
|
||||
* OneDrive
|
||||
* Re-enable server side copy
|
||||
* Don't mask HTTP error codes with JSON decode error
|
||||
* S3
|
||||
@@ -407,11 +510,11 @@ Changelog
|
||||
* Stop SetModTime losing metadata (eg X-Object-Manifest)
|
||||
* This could have caused data loss for files > 5GB in size
|
||||
* Use ContentType from Object to avoid lookups in listings
|
||||
* One Drive
|
||||
* OneDrive
|
||||
* disable server side copy as it seems to be broken at Microsoft
|
||||
* v1.24 - 2015-11-07
|
||||
* New features
|
||||
* Add support for Microsoft One Drive
|
||||
* Add support for Microsoft OneDrive
|
||||
* Add `--no-check-certificate` option to disable server certificate verification
|
||||
* Add async readahead buffer for faster transfer of big files
|
||||
* Fixes
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone"
|
||||
slug: rclone
|
||||
url: /commands/rclone/
|
||||
---
|
||||
## rclone
|
||||
|
||||
Sync files and directories to and from local and remote object stores - v1.36
|
||||
Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
|
||||
Rclone is a command line program to sync files and directories to and
|
||||
from various cloud storage systems, such as:
|
||||
from various cloud storage systems and using file transfer services, such as:
|
||||
|
||||
* Google Drive
|
||||
* Amazon S3
|
||||
@@ -21,10 +21,13 @@ from various cloud storage systems, such as:
|
||||
* Dropbox
|
||||
* Google Cloud Storage
|
||||
* Amazon Drive
|
||||
* Microsoft One Drive
|
||||
* Microsoft OneDrive
|
||||
* Hubic
|
||||
* Backblaze B2
|
||||
* Yandex Disk
|
||||
* SFTP
|
||||
* FTP
|
||||
* HTTP
|
||||
* The local filesystem
|
||||
|
||||
Features
|
||||
@@ -40,11 +43,11 @@ Features
|
||||
See the home page for installation, usage, documentation, changelog
|
||||
and configuration walkthroughs.
|
||||
|
||||
* http://rclone.org/
|
||||
* https://rclone.org/
|
||||
|
||||
|
||||
```
|
||||
rclone
|
||||
rclone [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
@@ -71,12 +74,13 @@ rclone
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -87,17 +91,21 @@ rclone
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -110,7 +118,7 @@ rclone
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -120,12 +128,15 @@ rclone
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -141,7 +152,8 @@ rclone
|
||||
* [rclone config](/commands/rclone_config/) - Enter an interactive configuration session.
|
||||
* [rclone copy](/commands/rclone_copy/) - Copy files from source to dest, skipping already copied
|
||||
* [rclone copyto](/commands/rclone_copyto/) - Copy files from source to dest, skipping already copied
|
||||
* [rclone cryptcheck](/commands/rclone_cryptcheck/) - Cryptcheck checks the integritity of a crypted remote.
|
||||
* [rclone cryptcheck](/commands/rclone_cryptcheck/) - Cryptcheck checks the integrity of a crypted remote.
|
||||
* [rclone dbhashsum](/commands/rclone_dbhashsum/) - Produces a Dropbbox hash file for all the objects in the path.
|
||||
* [rclone dedupe](/commands/rclone_dedupe/) - Interactively find duplicate files delete/rename them.
|
||||
* [rclone delete](/commands/rclone_delete/) - Remove the contents of path.
|
||||
* [rclone genautocomplete](/commands/rclone_genautocomplete/) - Output bash completion script for rclone.
|
||||
@@ -149,19 +161,21 @@ rclone
|
||||
* [rclone listremotes](/commands/rclone_listremotes/) - List all the remotes in the config file.
|
||||
* [rclone ls](/commands/rclone_ls/) - List all the objects in the path with size and path.
|
||||
* [rclone lsd](/commands/rclone_lsd/) - List all directories/containers/buckets in the path.
|
||||
* [rclone lsjson](/commands/rclone_lsjson/) - List directories and objects in the path in JSON format.
|
||||
* [rclone lsl](/commands/rclone_lsl/) - List all the objects path with modification time, size and path.
|
||||
* [rclone md5sum](/commands/rclone_md5sum/) - Produces an md5sum file for all the objects in the path.
|
||||
* [rclone mkdir](/commands/rclone_mkdir/) - Make the path if it doesn't already exist.
|
||||
* [rclone mount](/commands/rclone_mount/) - Mount the remote as a mountpoint. **EXPERIMENTAL**
|
||||
* [rclone move](/commands/rclone_move/) - Move files from source to dest.
|
||||
* [rclone moveto](/commands/rclone_moveto/) - Move file or directory from source to dest.
|
||||
* [rclone ncdu](/commands/rclone_ncdu/) - Explore a remote with a text based user interface.
|
||||
* [rclone obscure](/commands/rclone_obscure/) - Obscure password for use in the rclone.conf
|
||||
* [rclone purge](/commands/rclone_purge/) - Remove the path and all of its contents.
|
||||
* [rclone rmdir](/commands/rclone_rmdir/) - Remove the path if empty.
|
||||
* [rclone rmdirs](/commands/rclone_rmdirs/) - Remove any empty directoryies under the path.
|
||||
* [rclone rmdirs](/commands/rclone_rmdirs/) - Remove empty directories under the path.
|
||||
* [rclone sha1sum](/commands/rclone_sha1sum/) - Produces an sha1sum file for all the objects in the path.
|
||||
* [rclone size](/commands/rclone_size/) - Prints the total size and number of objects in remote:path.
|
||||
* [rclone sync](/commands/rclone_sync/) - Make source and dest identical, modifying destination only.
|
||||
* [rclone version](/commands/rclone_version/) - Show the version number.
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone authorize"
|
||||
slug: rclone_authorize
|
||||
url: /commands/rclone_authorize/
|
||||
@@ -44,12 +44,13 @@ rclone authorize
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -60,17 +61,21 @@ rclone authorize
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -83,7 +88,7 @@ rclone authorize
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -93,12 +98,15 @@ rclone authorize
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -106,6 +114,6 @@ rclone authorize
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone cat"
|
||||
slug: rclone_cat
|
||||
url: /commands/rclone_cat/
|
||||
@@ -33,7 +33,7 @@ Note that if offset is negative it will count from the end, so
|
||||
|
||||
|
||||
```
|
||||
rclone cat remote:path
|
||||
rclone cat remote:path [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
@@ -70,12 +70,13 @@ rclone cat remote:path
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -86,17 +87,21 @@ rclone cat remote:path
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -109,7 +114,7 @@ rclone cat remote:path
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -119,12 +124,15 @@ rclone cat remote:path
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -132,6 +140,6 @@ rclone cat remote:path
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone check"
|
||||
slug: rclone_check
|
||||
url: /commands/rclone_check/
|
||||
@@ -26,7 +26,7 @@ to check all the data.
|
||||
|
||||
|
||||
```
|
||||
rclone check source:path dest:path
|
||||
rclone check source:path dest:path [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
@@ -59,12 +59,13 @@ rclone check source:path dest:path
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -75,17 +76,21 @@ rclone check source:path dest:path
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -98,7 +103,7 @@ rclone check source:path dest:path
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -108,12 +113,15 @@ rclone check source:path dest:path
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -121,6 +129,6 @@ rclone check source:path dest:path
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone cleanup"
|
||||
slug: rclone_cleanup
|
||||
url: /commands/rclone_cleanup/
|
||||
@@ -44,12 +44,13 @@ rclone cleanup remote:path
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -60,17 +61,21 @@ rclone cleanup remote:path
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -83,7 +88,7 @@ rclone cleanup remote:path
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -93,12 +98,15 @@ rclone cleanup remote:path
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -106,6 +114,6 @@ rclone cleanup remote:path
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone config"
|
||||
slug: rclone_config
|
||||
url: /commands/rclone_config/
|
||||
@@ -41,12 +41,13 @@ rclone config
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -57,17 +58,21 @@ rclone config
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -80,7 +85,7 @@ rclone config
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -90,12 +95,15 @@ rclone config
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -103,6 +111,6 @@ rclone config
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone copy"
|
||||
slug: rclone_copy
|
||||
url: /commands/rclone_copy/
|
||||
@@ -80,12 +80,13 @@ rclone copy source:path dest:path
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -96,17 +97,21 @@ rclone copy source:path dest:path
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -119,7 +124,7 @@ rclone copy source:path dest:path
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -129,12 +134,15 @@ rclone copy source:path dest:path
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -142,6 +150,6 @@ rclone copy source:path dest:path
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone copyto"
|
||||
slug: rclone_copyto
|
||||
url: /commands/rclone_copyto/
|
||||
@@ -67,12 +67,13 @@ rclone copyto source:path dest:path
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -83,17 +84,21 @@ rclone copyto source:path dest:path
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -106,7 +111,7 @@ rclone copyto source:path dest:path
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -116,12 +121,15 @@ rclone copyto source:path dest:path
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -129,6 +137,6 @@ rclone copyto source:path dest:path
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone cryptcheck"
|
||||
slug: rclone_cryptcheck
|
||||
url: /commands/rclone_cryptcheck/
|
||||
---
|
||||
## rclone cryptcheck
|
||||
|
||||
Cryptcheck checks the integritity of a crypted remote.
|
||||
Cryptcheck checks the integrity of a crypted remote.
|
||||
|
||||
### Synopsis
|
||||
|
||||
@@ -64,12 +64,13 @@ rclone cryptcheck remote:path cryptedremote:path
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -80,17 +81,21 @@ rclone cryptcheck remote:path cryptedremote:path
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -103,7 +108,7 @@ rclone cryptcheck remote:path cryptedremote:path
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -113,12 +118,15 @@ rclone cryptcheck remote:path cryptedremote:path
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -126,6 +134,6 @@ rclone cryptcheck remote:path cryptedremote:path
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -0,0 +1,121 @@
|
||||
---
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone dbhashsum"
|
||||
slug: rclone_dbhashsum
|
||||
url: /commands/rclone_dbhashsum/
|
||||
---
|
||||
## rclone dbhashsum
|
||||
|
||||
Produces a Dropbbox hash file for all the objects in the path.
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
|
||||
Produces a Dropbox hash file for all the objects in the path. The
|
||||
hashes are calculated according to [Dropbox content hash
|
||||
rules](https://www.dropbox.com/developers/reference/content-hash).
|
||||
The output is in the same format as md5sum and sha1sum.
|
||||
|
||||
|
||||
```
|
||||
rclone dbhashsum remote:path
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--acd-templink-threshold int Files >= this size will be downloaded via their tempLink. (default 9G)
|
||||
--acd-upload-wait-per-gb duration Additional time per GB to wait after a failed complete upload to see if it appears. (default 3m0s)
|
||||
--ask-password Allow prompt for password for encrypted configuration. (default true)
|
||||
--b2-chunk-size int Upload chunk size. Must fit in memory. (default 96M)
|
||||
--b2-test-mode string A flag string for X-Bz-Test-Mode header.
|
||||
--b2-upload-cutoff int Cutoff for switching to chunked upload (default 190.735M)
|
||||
--b2-versions Include old versions in directory listings.
|
||||
--backup-dir string Make backups into hierarchy based in DIR.
|
||||
--buffer-size int Buffer size when copying files. (default 16M)
|
||||
--bwlimit BwTimetable Bandwidth limit in kBytes/s, or use suffix b|k|M|G or a full timetable.
|
||||
--checkers int Number of checkers to run in parallel. (default 8)
|
||||
-c, --checksum Skip based on checksum & size, not mod-time & size
|
||||
--config string Config file. (default "/home/ncw/.rclone.conf")
|
||||
--contimeout duration Connect timeout (default 1m0s)
|
||||
-L, --copy-links Follow symlinks and copy the pointed to item.
|
||||
--cpuprofile string Write cpu profile to file
|
||||
--crypt-show-mapping For all files listed show how the names encrypt.
|
||||
--delete-after When synchronizing, delete files on destination after transfering
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
-n, --dry-run Do a trial run with no permanent changes
|
||||
--dump-auth Dump HTTP headers with auth info
|
||||
--dump-bodies Dump HTTP headers and bodies - may contain sensitive info
|
||||
--dump-filters Dump the filters to the output
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
--max-size int Don't transfer any file larger than this in k or suffix b|k|M|G (default off)
|
||||
--memprofile string Write memory profile to file
|
||||
--min-age string Don't transfer any file younger than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--min-size int Don't transfer any file smaller than this in k or suffix b|k|M|G (default off)
|
||||
--modify-window duration Max time diff to be considered the same (default 1ns)
|
||||
--no-check-certificate Do not verify the server SSL certificate. Insecure.
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
-q, --quiet Print as little stuff as possible
|
||||
--retries int Retry operations this many times if they fail (default 3)
|
||||
--s3-acl string Canned ACL used when creating buckets and/or storing objects in S3
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
-v, --verbose count[=-1] Print lots more stuff (repeat for more)
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone dedupe"
|
||||
slug: rclone_dedupe
|
||||
url: /commands/rclone_dedupe/
|
||||
@@ -89,7 +89,7 @@ Or
|
||||
|
||||
|
||||
```
|
||||
rclone dedupe [mode] remote:path
|
||||
rclone dedupe [mode] remote:path [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
@@ -122,12 +122,13 @@ rclone dedupe [mode] remote:path
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -138,17 +139,21 @@ rclone dedupe [mode] remote:path
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -161,7 +166,7 @@ rclone dedupe [mode] remote:path
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -171,12 +176,15 @@ rclone dedupe [mode] remote:path
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -184,6 +192,6 @@ rclone dedupe [mode] remote:path
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone delete"
|
||||
slug: rclone_delete
|
||||
url: /commands/rclone_delete/
|
||||
@@ -58,12 +58,13 @@ rclone delete remote:path
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -74,17 +75,21 @@ rclone delete remote:path
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -97,7 +102,7 @@ rclone delete remote:path
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -107,12 +112,15 @@ rclone delete remote:path
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -120,6 +128,6 @@ rclone delete remote:path
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone genautocomplete"
|
||||
slug: rclone_genautocomplete
|
||||
url: /commands/rclone_genautocomplete/
|
||||
@@ -56,12 +56,13 @@ rclone genautocomplete [output_file]
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -72,17 +73,21 @@ rclone genautocomplete [output_file]
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -95,7 +100,7 @@ rclone genautocomplete [output_file]
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -105,12 +110,15 @@ rclone genautocomplete [output_file]
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -118,6 +126,6 @@ rclone genautocomplete [output_file]
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone gendocs"
|
||||
slug: rclone_gendocs
|
||||
url: /commands/rclone_gendocs/
|
||||
@@ -17,7 +17,13 @@ supplied. These are in a format suitable for hugo to render into the
|
||||
rclone.org website.
|
||||
|
||||
```
|
||||
rclone gendocs output_directory
|
||||
rclone gendocs output_directory [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for gendocs
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
@@ -44,12 +50,13 @@ rclone gendocs output_directory
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -60,17 +67,21 @@ rclone gendocs output_directory
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -83,7 +94,7 @@ rclone gendocs output_directory
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -93,12 +104,15 @@ rclone gendocs output_directory
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -106,6 +120,6 @@ rclone gendocs output_directory
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone listremotes"
|
||||
slug: rclone_listremotes
|
||||
url: /commands/rclone_listremotes/
|
||||
@@ -18,7 +18,7 @@ When uses with the -l flag it lists the types too.
|
||||
|
||||
|
||||
```
|
||||
rclone listremotes
|
||||
rclone listremotes [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
@@ -51,12 +51,13 @@ rclone listremotes
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -67,17 +68,21 @@ rclone listremotes
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -90,7 +95,7 @@ rclone listremotes
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -100,12 +105,15 @@ rclone listremotes
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -113,6 +121,6 @@ rclone listremotes
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone ls"
|
||||
slug: rclone_ls
|
||||
url: /commands/rclone_ls/
|
||||
@@ -41,12 +41,13 @@ rclone ls remote:path
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -57,17 +58,21 @@ rclone ls remote:path
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -80,7 +85,7 @@ rclone ls remote:path
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -90,12 +95,15 @@ rclone ls remote:path
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -103,6 +111,6 @@ rclone ls remote:path
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2017-03-18T11:14:54Z
|
||||
date: 2017-07-22T18:15:25+01:00
|
||||
title: "rclone lsd"
|
||||
slug: rclone_lsd
|
||||
url: /commands/rclone_lsd/
|
||||
@@ -41,12 +41,13 @@ rclone lsd remote:path
|
||||
--delete-before When synchronizing, delete files on destination before transfering
|
||||
--delete-during When synchronizing, delete files during transfer (default)
|
||||
--delete-excluded Delete files on dest excluded from sync
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user. Requires drive-full-list.
|
||||
--drive-auth-owner-only Only consider files owned by the authenticated user.
|
||||
--drive-chunk-size int Upload chunk size. Must a power of 2 >= 256k. (default 8M)
|
||||
--drive-formats string Comma separated list of preferred formats for downloading Google docs. (default "docx,xlsx,pptx,svg")
|
||||
--drive-full-list Use a full listing for directory list. More data but usually quicker. (obsolete)
|
||||
--drive-list-chunk int Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
--drive-shared-with-me Only show files that are shared with me
|
||||
--drive-skip-gdocs Skip google documents in all listings.
|
||||
--drive-trashed-only Only show files that are in the trash
|
||||
--drive-upload-cutoff int Cutoff for switching to chunked upload (default 8M)
|
||||
--drive-use-trash Send files to the trash instead of deleting permanently.
|
||||
--dropbox-chunk-size int Upload chunk size. Max 150M. (default 128M)
|
||||
@@ -57,17 +58,21 @@ rclone lsd remote:path
|
||||
--dump-headers Dump HTTP headers - may contain sensitive info
|
||||
--exclude stringArray Exclude files matching pattern
|
||||
--exclude-from stringArray Read exclude patterns from file
|
||||
--fast-list Use recursive list if available. Uses more memory but fewer transactions.
|
||||
--files-from stringArray Read list of source-file names from file
|
||||
-f, --filter stringArray Add a file-filtering rule
|
||||
--filter-from stringArray Read filtering patterns from a file
|
||||
--gcs-location string Default location for buckets (us|eu|asia|us-central1|us-east1|us-east4|us-west1|asia-east1|asia-noetheast1|asia-southeast1|australia-southeast1|europe-west1|europe-west2).
|
||||
--gcs-storage-class string Default storage class for buckets (MULTI_REGIONAL|REGIONAL|STANDARD|NEARLINE|COLDLINE|DURABLE_REDUCED_AVAILABILITY).
|
||||
--ignore-checksum Skip post copy check of checksums.
|
||||
--ignore-existing Skip all files that exist on destination
|
||||
--ignore-size Ignore size when skipping use mod-time or checksum.
|
||||
-I, --ignore-times Don't skip files that match size and time - transfer all files
|
||||
--include stringArray Include files matching pattern
|
||||
--include-from stringArray Read include patterns from file
|
||||
--local-no-unicode-normalization Don't apply unicode normalization to paths and filenames
|
||||
--log-file string Log everything to this file
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--log-level string Log level DEBUG|INFO|NOTICE|ERROR (default "NOTICE")
|
||||
--low-level-retries int Number of low level retries to do. (default 10)
|
||||
--max-age string Don't transfer any file older than this in s or suffix ms|s|m|h|d|w|M|y
|
||||
--max-depth int If set limits the recursion depth to this. (default -1)
|
||||
@@ -80,7 +85,7 @@ rclone lsd remote:path
|
||||
--no-gzip-encoding Don't set Accept-Encoding: gzip.
|
||||
--no-traverse Don't traverse destination file system on copy.
|
||||
--no-update-modtime Don't update destination mod-time if files identical.
|
||||
--old-sync-method Temporary flag to select old sync method
|
||||
--old-sync-method Deprecated - use --fast-list instead
|
||||
-x, --one-file-system Don't cross filesystem boundaries.
|
||||
--onedrive-chunk-size int Above this size files will be chunked - must be multiple of 320k. (default 10M)
|
||||
--onedrive-upload-cutoff int Cutoff for switching to chunked upload - must be <= 100MB (default 10M)
|
||||
@@ -90,12 +95,15 @@ rclone lsd remote:path
|
||||
--s3-storage-class string Storage class to use when uploading S3 objects (STANDARD|REDUCED_REDUNDANCY|STANDARD_IA)
|
||||
--size-only Skip based on size only, not mod-time or checksum
|
||||
--stats duration Interval between printing stats, e.g 500ms, 60s, 5m. (0 to disable) (default 1m0s)
|
||||
--stats-log-level string Log level to show --stats output DEBUG|INFO|NOTICE|ERROR (default "INFO")
|
||||
--stats-unit string Show data rate in stats as either 'bits' or 'bytes'/s (default "bytes")
|
||||
--suffix string Suffix for use with --backup-dir.
|
||||
--swift-chunk-size int Above this size files will be chunked into a _segments container. (default 5G)
|
||||
--syslog Use Syslog for logging
|
||||
--syslog-facility string Facility for syslog, eg KERN,USER,... (default "DAEMON")
|
||||
--timeout duration IO idle timeout (default 5m0s)
|
||||
--tpslimit float Limit HTTP transactions per second to this.
|
||||
--tpslimit-burst int Max burst of transactions for --tpslimit. (default 1)
|
||||
--track-renames When synchronizing, track file renames and do a server side move if possible
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
-u, --update Skip files that are newer on the destination.
|
||||
@@ -103,6 +111,6 @@ rclone lsd remote:path
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.36
|
||||
* [rclone](/commands/rclone/) - Sync files and directories to and from local and remote object stores - v1.37
|
||||
|
||||
###### Auto generated by spf13/cobra on 18-Mar-2017
|
||||
###### Auto generated by spf13/cobra on 22-Jul-2017
|
||||
Loaded 100 of 5662 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user