Update install.sh

This commit is contained in:
colin 2024-05-23 03:21:22 +00:00
parent 7d26a3d6a5
commit 594a6c271b
1 changed files with 5 additions and 2 deletions

View File

@ -31,10 +31,13 @@ BINARY_URL="${BASE_URL}/${binaries[$KEY]}"
echo "Downloading and installing $BINARY_NAME from $BINARY_URL..."
sudo curl -sSL "$BINARY_URL" -o "${INSTALL_DIR}/${BINARY_NAME}"
if [[ $? -eq 0 ]]; then
# Verify the downloaded file is not an error message or too small
if [[ -f "${INSTALL_DIR}/${BINARY_NAME}" && $(wc -c <"${INSTALL_DIR}/${BINARY_NAME}") -gt 1000 ]]; then
sudo chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
echo "Installed $BINARY_NAME to $INSTALL_DIR"
else
echo "Failed to download or install $BINARY_NAME."
echo "Failed to download or install $BINARY_NAME. The downloaded file is too small or invalid."
sudo rm -f "${INSTALL_DIR}/${BINARY_NAME}"
exit 1
fi