From c525a054c21c71d9fd2db3c3db7cec2680dd0d26 Mon Sep 17 00:00:00 2001 From: Drew Short Date: Wed, 22 Jan 2020 21:31:37 -0600 Subject: [PATCH] Cleanup rclone configuration --- assets/common.sh | 13 +++++-------- assets/out | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/assets/common.sh b/assets/common.sh index c2bf471..f93ba8f 100644 --- a/assets/common.sh +++ b/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 diff --git a/assets/out b/assets/out index 52b43c2..352d36e 100644 --- a/assets/out +++ b/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}"