From ec112d4bab7dc512a8d7ed3bc880ab610abb659a Mon Sep 17 00:00:00 2001 From: Damien Duportal Date: Mon, 2 Sep 2024 14:59:29 +0200 Subject: [PATCH] chore(adoptium install script) show 'curl' errors when it fails (as silent mode is used) Signed-off-by: Damien Duportal --- adoptium-get-jdk-link.sh | 4 ++-- adoptium-install-jdk.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/adoptium-get-jdk-link.sh b/adoptium-get-jdk-link.sh index bfcea2a33..fe558a3f1 100755 --- a/adoptium-get-jdk-link.sh +++ b/adoptium-get-jdk-link.sh @@ -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 @@ -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 diff --git a/adoptium-install-jdk.sh b/adoptium-install-jdk.sh index 5c8812d04..aa45ac6ee 100755 --- a/adoptium-install-jdk.sh +++ b/adoptium-install-jdk.sh @@ -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