2014-01-14 17:45:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-09-04 04:56:29 +00:00
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2014-01-14 17:45:41 +00:00
|
|
|
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" ]
|
|
|
|
|
2016-11-01 14:19:44 +00:00
|
|
|
if [[ "amd64 x86_64" =~ "$ARCH" ]]; then
|
2014-05-02 17:02:38 +00:00
|
|
|
ARCH="x86_64"
|
2015-04-27 09:59:23 +00:00
|
|
|
else
|
2016-11-01 14:19:44 +00:00
|
|
|
echo 'rhel7 root element only support the x86_64 $ARCH value.'
|
2015-04-27 09:59:23 +00:00
|
|
|
exit 1
|
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
|
2016-06-22 15:10:04 +00:00
|
|
|
if [ -z "${BASE_IMAGE_FILE:-}" -o -z "${DIB_CLOUD_IMAGES:-}" ]; then
|
2015-09-10 20:09:48 +00:00
|
|
|
echo "No source for a base image file configured."
|
|
|
|
echo "See rhel7 element readme for details on how to obtain and use a base image."
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-01-14 17:45:41 +00:00
|
|
|
DIB_RELEASE=${DIB_RELEASE:-latest}
|
|
|
|
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
|