2013-02-13 22:16:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-09-04 04:56:29 +00:00
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2013-07-17 22:15:02 +00:00
|
|
|
set -eu
|
2014-04-03 02:24:15 +00:00
|
|
|
set -o pipefail
|
2013-02-13 22:16:00 +00:00
|
|
|
|
|
|
|
[ -n "$ARCH" ]
|
|
|
|
[ -n "$TARGET_ROOT" ]
|
|
|
|
|
|
|
|
if [ 'amd64' = "$ARCH" ] ; then
|
2014-05-02 17:02:38 +00:00
|
|
|
ARCH="x86_64"
|
2013-02-13 22:16:00 +00:00
|
|
|
fi
|
2023-03-10 17:32:08 +00:00
|
|
|
if [[ "${ARCH}" == "arm64" ]]; then
|
|
|
|
ARCH="aarch64"
|
|
|
|
fi
|
2013-02-13 22:16:00 +00:00
|
|
|
|
2014-01-21 14:46:06 +00:00
|
|
|
DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-""}
|
|
|
|
|
|
|
|
if [ -n "$DIB_LOCAL_IMAGE" ]; then
|
|
|
|
IMAGE_LOCATION=$DIB_LOCAL_IMAGE
|
|
|
|
# No need to copy a local image into the cache directory, so just specify
|
|
|
|
# the cached path as the original path.
|
|
|
|
CACHED_IMAGE=$IMAGE_LOCATION
|
|
|
|
BASE_IMAGE_FILE=`basename $DIB_LOCAL_IMAGE`
|
|
|
|
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
|
|
|
|
else
|
2015-06-12 05:49:16 +00:00
|
|
|
# note default DIB_RELEASE set in environment setup
|
2018-03-01 20:29:17 +00:00
|
|
|
case ${ARCH} in
|
2019-04-09 15:49:37 +00:00
|
|
|
x86_64|aarch64)
|
2023-08-07 12:37:39 +00:00
|
|
|
if [[ ${DIB_RELEASE} -ge 37 ]]; then
|
2018-05-04 14:58:00 +00:00
|
|
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://download.fedoraproject.org/pub/fedora/linux/releases/${DIB_RELEASE}/Cloud/${ARCH}/images}
|
2023-08-07 12:37:39 +00:00
|
|
|
elif [[ ${DIB_RELEASE} -ge 28 ]] && [[ ${DIB_RELEASE} -le 36 ]]; then
|
|
|
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/${DIB_RELEASE}/Cloud/${ARCH}/images}
|
2018-05-04 14:58:00 +00:00
|
|
|
else
|
2023-08-07 12:37:39 +00:00
|
|
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/${DIB_RELEASE}/CloudImages/${ARCH}/images}
|
2018-05-04 14:58:00 +00:00
|
|
|
fi
|
2018-03-01 20:29:17 +00:00
|
|
|
;;
|
2019-04-09 15:49:37 +00:00
|
|
|
ppc64|ppc64le)
|
2023-08-07 12:37:39 +00:00
|
|
|
if [[ ${DIB_RELEASE} -ge 37 ]]; then
|
2018-05-04 14:58:00 +00:00
|
|
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://dl.fedoraproject.org/pub/fedora-secondary/releases/${DIB_RELEASE}/Cloud/${ARCH}/images}
|
2023-08-07 12:37:39 +00:00
|
|
|
elif [[ ${DIB_RELEASE} -ge 28 ]] && [[ ${DIB_RELEASE} -le 36 ]]; then
|
|
|
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://archives.fedoraproject.org/pub/archive/fedora-secondary/releases/${DIB_RELEASE}/Cloud/${ARCH}/images}
|
2018-05-04 14:58:00 +00:00
|
|
|
else
|
2023-08-07 12:37:39 +00:00
|
|
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://archives.fedoraproject.org/pub/archive/fedora-secondary/releases/${DIB_RELEASE}/CloudImages/${ARCH}/images}
|
2018-05-04 14:58:00 +00:00
|
|
|
fi
|
2018-03-01 20:29:17 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Error: unknown ARCH: ${ARCH}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2022-04-26 07:22:46 +00:00
|
|
|
SUBRELEASE=$(head -1 < <(curl -Ls $DIB_CLOUD_IMAGES/ | grep -o -P '(?<=Fedora-Cloud-Base-'${DIB_RELEASE}'-).*?(?=.'${ARCH}'.qcow2")' | sort -r))
|
2020-10-05 06:47:43 +00:00
|
|
|
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
|
2014-01-21 14:46:06 +00:00
|
|
|
IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE
|
|
|
|
CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
|
|
|
|
fi
|
|
|
|
|
2014-02-18 22:20:14 +00:00
|
|
|
$TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_TAR $IMAGE_LOCATION $CACHED_IMAGE
|