Browse Source

Cleanup rclone configuration

expose_links
Drew Short 5 years ago
parent
commit
c525a054c2
  1. 13
      assets/common.sh
  2. 2
      assets/out

13
assets/common.sh

@ -3,11 +3,10 @@ export TMPDIR=${TMPDIR:-/tmp/rclone}
mkdir -p "${TMPDIR}"
load_config() {
local config_path=$TMPDIR/rclone_config
local rclone_config_path=/opt/rclone/config
local rclone_config_file=$rclone_config_path/.rclone.conf
RCLONE_CONFIG=$TMPDIR/.config/rclone_config
export RCLONE_CONFIG
(jq -r '.source.config // empty' < "$1") > "$config_path"
(jq -r '.source.config // empty' < "$1") > "$RCLONE_CONFIG"
config_pass=$(jq -r '.source.password // ""' < "$1")
if [[ -n "${config_pass}" ]]; then
@ -15,10 +14,8 @@ load_config() {
export RCLONE_CONFIG_PASS
fi
if [ -s "$config_path" ]; then
mkdir -p $rclone_config_path
mv "$config_path" $rclone_config_file
chmod 500 $rclone_config_file
if [ -s "${RCLONE_CONFIG}" ]; then
chmod 500 "${RCLONE_CONFIG}"
else
echo "No config provided"
exit 1

2
assets/out

@ -87,7 +87,7 @@ for destination in $destinations; do
rclone_target="${rclone_destination}/${rclone_destination_subdir}"
echo "Target: ${rclone_target}"
rclone copy "${rclone_source}" "${rclone_target}" --config /opt/rclone/config/.rclone.conf --size-only --progress --stats=2s
rclone copy "${rclone_source}" "${rclone_target}" --size-only --progress --stats=2s
if [[ "$rclone_dedupe" == "true" ]]; then
echo "Running Dedupe for: ${rclone_target}"

Loading…
Cancel
Save