From b919bb62f5d7bb056f609237706ea9db63827b00 Mon Sep 17 00:00:00 2001 From: Jan Verbeek Date: Wed, 1 Nov 2023 19:39:09 +0100 Subject: [PATCH 1/2] install.sh: Print curl error message on server error --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 1b89e552..534548ed 100644 --- a/install.sh +++ b/install.sh @@ -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 From 3f6b5d665a88f3d9e56a527a7fc98524b3bbd308 Mon Sep 17 00:00:00 2001 From: Jan Verbeek Date: Wed, 1 Nov 2023 19:40:14 +0100 Subject: [PATCH 2/2] install.sh: Do not use `tac` to buffer server response macOS doesn't ship `tac`. --- install.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 534548ed..10d29964 100644 --- a/install.sh +++ b/install.sh @@ -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