2014-01-14 17:45:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
2014-04-03 02:24:15 +00:00
|
|
|
set -o pipefail
|
2014-01-14 17:45:41 +00:00
|
|
|
|
|
|
|
[ -n "$ARCH" ]
|
|
|
|
[ -n "$TARGET_ROOT" ]
|
|
|
|
|
|
|
|
if [ 'amd64' = "$ARCH" ] ; then
|
2014-05-02 17:02:38 +00:00
|
|
|
ARCH="x86_64"
|
2014-01-14 17:45:41 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
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
|
|
|
|
DIB_RELEASE=${DIB_RELEASE:-latest}
|
|
|
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://rhn.redhat.com}
|
|
|
|
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-rhel-guest-image-6-6.5-20131115.0-1.qcow2}
|
|
|
|
BASE_IMAGE_TAR=$DIB_RELEASE-rhel-server-$ARCH-latest.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
|