Skip to content

Commit

Permalink
Merge pull request #338 from blyxxyz/install-no-tac
Browse files Browse the repository at this point in the history
install.sh: Do not use `tac` to buffer server response
  • Loading branch information
ducaale authored Nov 4, 2023
2 parents d34e053 + 3f6b5d6 commit 4ec81d0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fi
fetch()
{
if which curl > /dev/null; then
if [ "$#" -eq 2 ]; then curl -L -o "$1" "$2"; else curl -sSL "$1"; fi
if [ "$#" -eq 2 ]; then curl -fL -o "$1" "$2"; else curl -fsSL "$1"; fi
elif which wget > /dev/null; then
if [ "$#" -eq 2 ]; then wget -O "$1" "$2"; else wget -nv -O - "$1"; fi
else
Expand All @@ -29,10 +29,8 @@ fetch()

echo "Detected target: $target"

url=$(
fetch https://api.github.com/repos/ducaale/xh/releases/latest |
tac | tac | grep -wo -m1 "https://.*$target.tar.gz" || true
)
releases=$(fetch https://api.github.com/repos/ducaale/xh/releases/latest)
url=$(echo "$releases" | grep -wo -m1 "https://.*$target.tar.gz" || true)
if ! test "$url"; then
echo "Could not find release info"
exit 1
Expand Down

0 comments on commit 4ec81d0

Please sign in to comment.