diff --git a/diskimage_builder/elements/fedora/environment.d/10-fedora-distro-name.bash b/diskimage_builder/elements/fedora/environment.d/10-fedora-distro-name.bash index b044581a..b9a87ac1 100644 --- a/diskimage_builder/elements/fedora/environment.d/10-fedora-distro-name.bash +++ b/diskimage_builder/elements/fedora/environment.d/10-fedora-distro-name.bash @@ -1,2 +1,21 @@ export DISTRO_NAME=fedora export DIB_RELEASE=${DIB_RELEASE:-26} + +# Note the filename URL has a "sub-release" in it +# http:// ... Fedora-Cloud-Base-25-1.3.x86_64.qcow2 +# ^^^ +# It's not exactly clear how this is generated, or how we could +# determine this programatically. Other projects have more +# complicated regex-based scripts to find this, which we can examine +# if this becomes an issue ... see thread at [1] +# +# [1] https://lists.fedoraproject.org/archives/list/cloud@lists.fedoraproject.org/thread/2WFO2FKIGUQYRQXIR35UVJGRHF7LQENJ/ + +if [[ ${DIB_RELEASE} == '25' ]]; then + export DIB_FEDORA_SUBRELEASE=1.3 +elif [[ ${DIB_RELEASE} == '26' ]]; then + export DIB_FEDORA_SUBRELEASE=1.5 +else + echo "Unsupported Fedora release" + exit 1 +fi 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 c89e29be..7d1d9d21 100755 --- a/diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image +++ b/diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image @@ -24,12 +24,12 @@ if [ -n "$DIB_LOCAL_IMAGE" ]; then BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz else # note default DIB_RELEASE set in environment setup - DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.fedoraproject.org} - BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-fedora-$DIB_RELEASE.$ARCH.qcow2} - BASE_IMAGE_TAR=$DIB_RELEASE-Cloud-$ARCH-$DIB_RELEASE.tgz + # Not sure if ${ARCH} is defined for anything but x86_64 here + DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://download.fedoraproject.org/pub/fedora/linux/releases/${DIB_RELEASE}/CloudImages/${ARCH}/images} + BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-Fedora-Cloud-Base-$DIB_RELEASE-$DIB_FEDORA_SUBRELEASE.$ARCH.qcow2} + BASE_IMAGE_TAR=Fedora-Cloud-Base-$DIB_RELEASE-$DIB_FEDORA_SUBRELEASE.$ARCH.tgz IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE - fi $TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_TAR $IMAGE_LOCATION $CACHED_IMAGE