Skip to content

Commit

Permalink
fix: use status code for failure info
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincobain2000 committed Jan 8, 2025
1 parent 00edb26 commit ca8f8a5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ if [ "$INSTALL_VERSION" = "latest" ]; then
DOWNLOAD_URL="https://github.com/rakutentech/$THIS_PROJECT_NAME/releases/$INSTALL_VERSION/download/$THE_ARCH_BIN"
fi

curl -kL --progress-bar "$DOWNLOAD_URL" -o "$BIN_DIR"/$THIS_PROJECT_NAME
echo "Downloading from $DOWNLOAD_URL..."
HTTP_STATUS=$(curl -kL --progress-bar -w "%{http_code}" -o "$BIN_DIR/$THIS_PROJECT_NAME" "$DOWNLOAD_URL")

chmod +x "$BIN_DIR"/$THIS_PROJECT_NAME
if [ "$HTTP_STATUS" -ne 200 ]; then
echo "Error: Failed to download $THIS_PROJECT_NAME. HTTP status code: $HTTP_STATUS"
exit 1
fi

echo "Installed successfully to: $BIN_DIR/$THIS_PROJECT_NAME"
chmod +x "$BIN_DIR/$THIS_PROJECT_NAME"

echo "Installed successfully to: $BIN_DIR/$THIS_PROJECT_NAME"

0 comments on commit ca8f8a5

Please sign in to comment.