Skip to content

Commit

Permalink
download-from-s3: skip decompression if dst is .xz file
Browse files Browse the repository at this point in the history
Skip the decompression with `xz` if the destination file is expecting
the compressed `.xz` file.
  • Loading branch information
joverlee521 committed Oct 19, 2021
1 parent c866eb3 commit 10d3e25
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/download-from-s3
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ main() {
src_hash="$(aws s3api head-object --bucket "$bucket" --key "$key" --query Metadata.sha256sum --output text 2>/dev/null || echo "$no_hash")"

echo "[ INFO] Downloading $src$dst"
# shellcheck disable=SC2094 # Only checking dst filename without reading contents
if [[ $src_hash != "$dst_hash" ]]; then
aws s3 cp --no-progress "$src" - |
if [[ "$src" == *.gz ]]; then
gunzip -cfq
elif [[ "$src" == *.xz ]]; then
elif [[ "$src" == *.xz && "$dst" != *.xz ]]; then
xz -T0 -dcq
else
cat
Expand Down

0 comments on commit 10d3e25

Please sign in to comment.