From 05ccddfe906b0644813f86adde90665da6410c4b Mon Sep 17 00:00:00 2001 From: Drew Short Date: Wed, 22 Jan 2020 19:50:41 -0600 Subject: [PATCH] Updating sha256 calculation --- assets/out | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/out b/assets/out index 09f947f..22a2f52 100644 --- a/assets/out +++ b/assets/out @@ -49,8 +49,9 @@ jq -c '.params.destination[] | .dir' < "$payload" local_source_dir="${source}/${rclone_source_directory}" ls -alh "${local_source_dir}" -sha256=$( (find "${local_source_dir}" -type f -exec sha256sum {} \;) | cut -d ' ' -f1 ) - +echo "Generating SHA256" +(find "${local_source_dir}" -type f -exec sha256sum {} \;) | cut -d ' ' -f1 | xargs echo /tmp/rclone_source.sha256 +sha256=$(sha256sum /tmp/rclone_source.sha256 | cut -d' ' -f1) echo "sha256:${sha256}" # Source is always the same for each destination @@ -79,11 +80,11 @@ 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 --progress --size-only + rclone copy "${rclone_source}" "${rclone_target}" --config /opt/rclone/config/.rclone.conf --size-only --progress --stats-one-line --stats=2s done jq -n "{ version: { - digest: $( (echo -n "sha256:"; echo "$sha256") | jq -R . ) + digest: $( echo -n "sha256:$sha256" | jq -R . ) } }" >&3 \ No newline at end of file