diff --git a/diskimage_builder/elements/centos/root.d/10-centos-cloud-image b/diskimage_builder/elements/centos/root.d/10-centos-cloud-image index de79e4d9..d2529046 100755 --- a/diskimage_builder/elements/centos/root.d/10-centos-cloud-image +++ b/diskimage_builder/elements/centos/root.d/10-centos-cloud-image @@ -61,7 +61,7 @@ else else dib_release_path=${DIB_RELEASE} fi - BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$(curl -s https://cloud.centos.org/centos/${dib_release_path}/${ARCH}/images/ | grep -o "CentOS-.[^>]*${DIB_FLAVOR}-.[^>]*.qcow2" | sort -r | head -1)} + BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$(head -1 < <(curl -s https://cloud.centos.org/centos/${dib_release_path}/${ARCH}/images/ | grep -o "CentOS-.[^>]*${DIB_FLAVOR}-.[^>]*.qcow2" | sort -r))} fi BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE diff --git a/diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image b/diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image index 38793674..f3eb7bb1 100755 --- a/diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image +++ b/diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image @@ -44,7 +44,7 @@ else exit 1 ;; esac - SUBRELEASE=$(curl -Ls $DIB_CLOUD_IMAGES/ | grep -o -P '(?<=Fedora-Cloud-Base-'${DIB_RELEASE}'-).*?(?=.'${ARCH}'.qcow2")' | sort -r | head -1) + SUBRELEASE=$(head -1 < <(curl -Ls $DIB_CLOUD_IMAGES/ | grep -o -P '(?<=Fedora-Cloud-Base-'${DIB_RELEASE}'-).*?(?=.'${ARCH}'.qcow2")' | sort -r)) BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-Fedora-Cloud-Base-$DIB_RELEASE-$SUBRELEASE.$ARCH.qcow2} BASE_IMAGE_TAR=Fedora-Cloud-Base-$DIB_RELEASE-$SUBRELEASE.$ARCH.tgz IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE