Skip to content

Commit

Permalink
fetch-configlet_v3: Improve archive extraction logic
Browse files Browse the repository at this point in the history
This gives a single source of truth for the name of the archive and for
the curl command.

It also gets around the fact that the `tar` command should probably have
had `-` previously to specify reading from `stdin`.
  • Loading branch information
ee7 committed Jan 12, 2021
1 parent 550a4c3 commit 774305f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/fetch-configlet_v3
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ get_download_url() {
}

download_url="$(get_download_url)"
output_path="bin/latest-configlet.${ext}"
curl "${curlopts[@]}" "${download_url}" -o "${output_path}"

case "${ext}" in
*zip)
curl "${curlopts[@]}" "${download_url}" -o bin/latest-configlet.zip
unzip bin/latest-configlet.zip -d bin/
rm bin/latest-configlet.zip
;;
*) curl "${curlopts[@]}" "${download_url}" | tar xz -C bin/ ;;
*zip) unzip "${output_path}" -d bin/ ;;
*) tar xzf "${output_path}" -C bin/ ;;
esac

rm -f "${output_path}"

0 comments on commit 774305f

Please sign in to comment.