This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -u
|
||||
|
||||
# Create rclone config on-the-fly in a writable location
|
||||
RCLONE_CONFIG_DIR="/tmp/rclone"
|
||||
mkdir -p "$RCLONE_CONFIG_DIR"
|
||||
@@ -16,18 +18,28 @@ region = $MINIO_LOCATION
|
||||
acl = private
|
||||
no_check_bucket = true
|
||||
EOF
|
||||
chmod 600 "$RCLONE_CONFIG"
|
||||
|
||||
case $1 in
|
||||
# All commands take full remote paths; callers own the path building.
|
||||
case "${1:-}" in
|
||||
copy)
|
||||
echo "copy from $2 to $3"
|
||||
rclone copy --progress $2 $3
|
||||
rclone copy --stats-one-line --retries 3 "$2" "$3"
|
||||
;;
|
||||
list)
|
||||
echo "list ${MINIO_PATH}/$2"
|
||||
rclone ls ${MINIO_PATH}/$2
|
||||
echo "list $2" >&2
|
||||
rclone ls "$2"
|
||||
;;
|
||||
size)
|
||||
# bytes of a single remote object, empty output if it does not exist
|
||||
rclone lsf --format s "$2" 2>/dev/null
|
||||
;;
|
||||
delete)
|
||||
echo "delete ${MINIO_PATH}/$2"
|
||||
rclone delete ${MINIO_PATH}/$2
|
||||
echo "delete $2"
|
||||
rclone deletefile "$2"
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 {copy SRC DST|list PATH|size FILE|delete FILE}" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user