#!/bin/bash set -eo pipefail # Make sure rclone is installed if ! command -v rclone &> /dev/null; then # Rclone is not installed, ask if we should install it read -p "rclone not installed. Do you want to install it? [y/N] " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]] then echo "Not installing rclone, exiting." exit 1 fi # Install rclone curl https://rclone.org/install.sh | sudo bash fi if [[ -z "${RCLONE_DROPBOX_CLIENT_ID}" ]]; then read -p "Please enter dropbox client_id: " RCLONE_DROPBOX_CLIENT_ID export RCLONE_DROPBOX_CLIENT_ID fi if [[ -z "${RCLONE_DROPBOX_CLIENT_SECRET}" ]]; then read -p "Please enter dropbox client_secret: " RCLONE_DROPBOX_CLIENT_SECRET export RCLONE_DROPBOX_CLIENT_SECRET fi if [[ -z "${RCLONE_DROPBOX_TOKEN}" ]]; then read -p "Please enter dropbox access_token: " DROPBOX_ACCESS_TOKEN RCLONE_DROPBOX_TOKEN="{\"access_token\":\"$DROPBOX_ACCESS_TOKEN\",\"token_type\":\"bearer\",\"expiry\":\"0001-01-01T00:00:00Z\"}" export RCLONE_DROPBOX_TOKEN fi if [[ -z "${RCLONE_B2_ACCOUNT}" ]]; then read -p "Please enter b2 key_id: " RCLONE_B2_ACCOUNT export RCLONE_B2_ACCOUNT fi if [[ -z "${RCLONE_B2_KEY}" ]]; then read -p "Please enter b2 key: " RCLONE_B2_KEY export RCLONE_B2_KEY fi export RCLONE_B2_HARD_DELETE=true rclone copy :dropbox:/ :b2://carl-files/dropbox --progress --tpslimit 9