diff --git a/install.sh b/install.sh index 3abb417..3ce8591 100755 --- a/install.sh +++ b/install.sh @@ -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