From: Frank Brehm Date: Thu, 30 May 2024 10:04:01 +0000 (+0200) Subject: Finishing scripts/get-rhel-dvd-iso-image X-Git-Tag: 1.0.3~1^2~3 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=ea8f1d8acaa4d570ec18135630115c914a596ba5;p=pixelpark%2Fpp-admin-tools.git Finishing scripts/get-rhel-dvd-iso-image --- diff --git a/scripts/get-rhel-dvd-iso-image b/scripts/get-rhel-dvd-iso-image index fa9ca4e..9111e9f 100755 --- a/scripts/get-rhel-dvd-iso-image +++ b/scripts/get-rhel-dvd-iso-image @@ -228,7 +228,7 @@ get_image_info() { info "Executing: ${cmd}" IMAGE="fake_image_info" BASE_FILE_NAME="fake-${output_base}" - DOWNLOAD_URL="fake_download_url" + DOWNLOAD_URL="${image_download_url}" else debug "Executing: ${cmd}" IMAGE_INFO=$( eval ${cmd} ) @@ -251,6 +251,27 @@ get_image_info() { debug "Got download URL: '${CYAN}${DOWNLOAD_URL}${NORMAL}'." info "Got output file: '${GREEN}${OUTPUT_FILE}${NORMAL}'." + + if [[ -z "${BASE_FILE_NAME}" || "${BASE_FILE_NAME}" =~ ^null || -z "${DOWNLOAD_URL}" || "${DOWNLOAD_URL}" =~ ^null ]] ; then + error "Error getting image information for RHEL DVD iso image." >&2 + exit 5 + fi + +} + +#------------------------------------------------------------------------------ +download_image() { + + info "Downloading '${GREEN}${OUTPUT_FILE}${NORMAL}' from URL '${GREEN}${DOWNLOAD_URL}${NORMAL}' ..." + + local cmd="curl -o '${OUTPUT_FILE}' '${DOWNLOAD_URL}'" + + if [[ "${SIMULATE}" == "y" ]] ; then + info "Executing: ${cmd}" + else + debug "Executing: ${cmd}" + eval ${cmd} + fi } #------------------------------------------------------------------------------ @@ -261,6 +282,7 @@ main() { set_locale "en_US.utf8" get_access_token get_image_info + download_image }