Skip to content

Commit

Permalink
Improve install diagnostic when using curl
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrange committed Apr 28, 2024
1 parent 30b5918 commit 3c1bdb0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

set -euo pipefail

CURL="curl --show-error --silent --location"

echo "downloading bash_unit"
current_working_dir=$PWD
tarball_urls=$(curl -s https://api.github.com/repos/pgrange/bash_unit/releases | grep tarball_url)
tarball_urls=$($CURL https://api.github.com/repos/pgrange/bash_unit/releases | grep tarball_url)
tarball_url=$(echo "$tarball_urls" | head -n 1 | cut -d '"' -f 4)
tmp_dir=$(mktemp -d 2>/dev/null || mktemp -d -t 'tmpdir')
cd "$tmp_dir" || exit
curl -Ls "$tarball_url" | tar -xz -f -
$CURL "$tarball_url" | tar -xz -f -
find "${tmp_dir}" -maxdepth 2 -type f -name "bash_unit" -exec cp {} "${current_working_dir}" \;
rm -rf "$tmp_dir"
echo "thank you for downloading bash_unit, you can now run ./bash_unit"

0 comments on commit 3c1bdb0

Please sign in to comment.