2014-07-03 01:49:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-09-04 04:56:29 +00:00
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2014-07-03 01:49:38 +00:00
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
[ -n "$ARCH" ]
|
|
|
|
[ -n "$TARGET_ROOT" ]
|
|
|
|
|
|
|
|
if [ 'amd64' = "$ARCH" ] ; then
|
|
|
|
ARCH="x86_64"
|
2015-04-27 09:59:23 +00:00
|
|
|
else
|
|
|
|
echo 'centos7 root element only support the amd64 $ARCH value.'
|
|
|
|
exit 1
|
2014-07-03 01:49:38 +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
|
2014-10-15 04:35:51 +00:00
|
|
|
DIB_RELEASE=${DIB_RELEASE:-GenericCloud-20140929_01}
|
|
|
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/centos/7/images}
|
2014-09-02 04:30:56 +00:00
|
|
|
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-7-x86_64-$DIB_RELEASE.qcow2}
|
2014-07-03 01:49:38 +00:00
|
|
|
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.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
|