Skip to content

Commit

Permalink
chore(adoptium install script) show 'curl' errors when it fails (as s…
Browse files Browse the repository at this point in the history
…ilent mode is used)

Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
  • Loading branch information
dduportal committed Sep 2, 2024
1 parent 5a37405 commit ec112d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions adoptium-get-jdk-link.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ for ARCH in ${ARCHS}; do
# Fetch the download URL from the Adoptium API
URL="https://api.adoptium.net/v3/binary/version/jdk-${ENCODED_ARCHIVE_DIRECTORY}/${OS_TYPE}/${ARCH}/jdk/hotspot/normal/eclipse?project=jdk"

if ! RESPONSE=$(curl --fail --silent --head "${URL}"); then
if ! RESPONSE=$(curl --fail --silent --show-error --head "${URL}"); then
echo "Error: Failed to fetch the URL for architecture ${ARCH}. Exiting with status 1." >&2
echo "Response: ${RESPONSE}" >&2
exit 1
Expand All @@ -91,7 +91,7 @@ for ARCH in ${ARCHS}; do

# Use curl to check if the URL is reachable
# If the URL is not reachable, print an error message and exit the script with status 1
if ! curl --verbose --fail --silent "${REDIRECTED_URL}" >/dev/null 2>&1; then
if ! curl --fail --silent --show-error "${REDIRECTED_URL}" >/dev/null 2>&1; then
echo "${REDIRECTED_URL}" is not reachable for architecture "${ARCH}". >&2
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion adoptium-install-jdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if ! DOWNLOAD_URL=$("${SCRIPT_DIR}"/adoptium-get-jdk-link.sh "${JAVA_VERSION}" "
fi

# Use curl to download the JDK archive from the URL
if ! curl --silent --location --output /tmp/jdk.tar.gz "${DOWNLOAD_URL}"; then
if ! curl --silent --show-error --location --output /tmp/jdk.tar.gz "${DOWNLOAD_URL}"; then
echo "Error: Failed to download the JDK archive. Exiting with status 1." >&2
exit 1
fi
Expand Down

0 comments on commit ec112d4

Please sign in to comment.