add rclone

This commit is contained in:
AJ ONeal
2021-03-03 08:01:26 +00:00
parent d356fd386b
commit cd1e0f64d8
4 changed files with 175 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
---
title: rclone
homepage: https://github.com/rclone/rclone
tagline: |
rclone: "rsync for cloud storage".
---
To update or switch versions, run `webi rclone@stable` (or `@v1.54`, `@beta`,
etc).
## Cheat Sheet
> rclone is like rsync, but optimized for cloud storage and SSDs. rclone is also
> faster than rsync for many use cases.
`rclone` is compatible with a wide range of cloud storage providers including:
- Google Drive
- S3
- (AWS, Minio, Digital Ocean, etc)
- Dropbox
- Backblaze B2
- One Drive
- Swift
- Hubic
- Wasabi
- Google Cloud Storage
- Yandex Files
### How to copy local files, like rsync
`rclone`s cloud-first, SSD-first optimizations can cause performance issues when
copying between HDDs. For performance more similar to `cp` (better than `rsync`)
you can use the following options:
`--tranfers=1` will only copy one file at a time, preventing thrashing and
fragmentation.
`--check-first` will catalog files before copying.
`--order-by name` will copy files one directory at a time.
Example:
```bash
rclone sync -vP --transfers=1 --order-by name --check-first ~/ /Volumes/Backup/home
```
Example, excluding common temporary directories:
```bash
rclone sync -vP --transfers=1 --order-by name --check-first \
--exclude 'node_modules/**' --exclude '.Spotlight-*/**' --exclude '.cache*/**' \
~/ /Volumes/Backup/home
```
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env pwsh
##################
# Install rclone #
##################
# Every package should define these variables
$pkg_cmd_name = "rclone"
$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\rclone.exe"
$pkg_dst = "$pkg_dst_cmd"
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\rclone-v$Env:WEBI_VERSION\bin\rclone.exe"
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\rclone-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\rclone-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
# TODO: arch detection
echo "Downloading rclone from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"
}
IF (!(Test-Path -Path "$pkg_src_cmd"))
{
echo "Installing rclone"
# TODO: create package-specific temp directory
# Enter tmp
pushd .local\tmp
# Remove any leftover tmp cruft
Remove-Item -Path ".\rclone-v*" -Recurse -ErrorAction Ignore
Remove-Item -Path ".\rclone.exe" -Recurse -ErrorAction Ignore
# Unpack archive file into this temporary directory
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $pkg_download"
& tar xf "$pkg_download"
# Settle unpacked archive into place
echo "Install Location: $pkg_src_cmd"
New-Item "$pkg_src_bin" -ItemType Directory -Force
Move-Item -Path ".\rclone.exe" -Destination "$pkg_src_bin"
# Exit tmp
popd
}
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
+44
View File
@@ -0,0 +1,44 @@
#!/bin/bash
function __init_rclone() {
set -e
set -u
##################
# Install rclone #
##################
# Every package should define these 6 variables
pkg_cmd_name="rclone"
pkg_dst_cmd="$HOME/.local/bin/rclone"
pkg_dst="$pkg_dst_cmd"
pkg_src_cmd="$HOME/.local/opt/rclone-v$WEBI_VERSION/bin/rclone"
pkg_src_dir="$HOME/.local/opt/rclone-v$WEBI_VERSION"
pkg_src="$pkg_src_cmd"
pkg_install() {
# $HOME/.local/opt/rclone-v0.6.5/bin
mkdir -p "$(dirname $pkg_src_cmd)"
# mv ./rclone* "$HOME/.local/opt/rclone-v0.6.5/bin/rclone"
mv ./rclone*/rclone "$pkg_src_cmd"
# chmod a+x "$HOME/.local/opt/rclone-v0.6.5/bin/rclone"
chmod a+x "$pkg_src_cmd"
}
pkg_get_current_version() {
# 'rclone version' has output in this format:
# rclone v1.54.0
# - os/arch: darwin/amd64
# - go version: go1.15.7
# This trims it down to just the version number:
# 1.54.0
echo "$(rclone --version 2>/dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')"
}
}
__init_rclone
+19
View File
@@ -0,0 +1,19 @@
'use strict';
var github = require('../_common/github.js');
var owner = 'rclone';
var repo = 'rclone';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
return all;
});
};
if (module === require.main) {
module.exports(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
all.releases = all.releases.slice(0, 10);
console.info(JSON.stringify(all, null, 2));
});
}