Merge "Migrate cloud image URL/Release options to DIB_."

This commit is contained in:
Jenkins 2013-04-12 19:59:19 +00:00 committed by Gerrit Code Review
commit 26ba473c72
4 changed files with 26 additions and 12 deletions

View File

@ -1 +1,8 @@
Use Fedora cloud images as the baseline for built disk images. Use Fedora cloud images as the baseline for built disk images.
Overrides:
* To use a non-default URL for downloading base Fedora cloud images,
use the environment variable DIB\_CLOUD\_IMAGES
* To download a non-default release of Fedora cloud images, use the
environment variable DIB\_RELEASE

View File

@ -10,16 +10,16 @@ if [ 'amd64' = "$ARCH" ] ; then
fi fi
IMG_PATH=~/.cache/image-create IMG_PATH=~/.cache/image-create
CLOUD_IMAGES=${CLOUD_IMAGES:-http://mattdm.fedorapeople.org/cloud-images/} DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://mattdm.fedorapeople.org/cloud-images/}
RELEASE=${RELEASE:-Fedora18} DIB_RELEASE=${DIB_RELEASE:-Fedora18}
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$RELEASE-Cloud-$ARCH-latest.raw.tar.xz} BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$DIB_RELEASE-Cloud-$ARCH-latest.raw.tar.xz}
BASE_IMAGE_TAR=$RELEASE-Cloud-$ARCH-latest.tgz BASE_IMAGE_TAR=$DIB_RELEASE-Cloud-$ARCH-latest.tgz
mkdir -p $IMG_PATH mkdir -p $IMG_PATH
# TODO: don't cache forever. # TODO: don't cache forever.
if [ ! -f $IMG_PATH/$BASE_IMAGE_FILE ] ; then if [ ! -f $IMG_PATH/$BASE_IMAGE_FILE ] ; then
echo "Fetching Base Image" echo "Fetching Base Image"
wget $CLOUD_IMAGES/$BASE_IMAGE_FILE -O $IMG_PATH/$BASE_IMAGE_FILE.tmp wget $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE -O $IMG_PATH/$BASE_IMAGE_FILE.tmp
mv $IMG_PATH/$BASE_IMAGE_FILE.tmp $IMG_PATH/$BASE_IMAGE_FILE mv $IMG_PATH/$BASE_IMAGE_FILE.tmp $IMG_PATH/$BASE_IMAGE_FILE
fi fi
if [ ! -f $IMG_PATH/$BASE_IMAGE_TAR ] ; then if [ ! -f $IMG_PATH/$BASE_IMAGE_TAR ] ; then

View File

@ -1 +1,8 @@
Use Ubuntu cloud images as the baseline for built disk images. Use Ubuntu cloud images as the baseline for built disk images.
Overrides:
* To use a non-default URL for downloading base Ubuntu cloud images,
use the environment variable DIB\_CLOUD\_IMAGES
* To download a non-default release of Ubuntu cloud images, use the
environment variable DIB\_RELEASE

View File

@ -7,19 +7,19 @@ set -e
[ -n "$TARGET_ROOT" ] [ -n "$TARGET_ROOT" ]
IMG_PATH=~/.cache/image-create IMG_PATH=~/.cache/image-create
CLOUD_IMAGES=${CLOUD_IMAGES:-http://cloud-images.ubuntu.com/} DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud-images.ubuntu.com/}
RELEASE=${RELEASE:-quantal} DIB_RELEASE=${DIB_RELEASE:-quantal}
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$RELEASE-server-cloudimg-$ARCH-root.tar.gz} BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$DIB_RELEASE-server-cloudimg-$ARCH-root.tar.gz}
SHA256SUMS=${SHA256SUMS:-https://cloud-images.ubuntu.com/$RELEASE/current/SHA256SUMS} SHA256SUMS=${SHA256SUMS:-https://${DIB_CLOUD_IMAGES##http?(s)://}/$DIB_RELEASE/current/SHA256SUMS}
mkdir -p $IMG_PATH mkdir -p $IMG_PATH
# TODO: don't cache -current forever. # TODO: don't cache -current forever.
if [ ! -f $IMG_PATH/$BASE_IMAGE_FILE ] ; then if [ ! -f $IMG_PATH/$BASE_IMAGE_FILE ] ; then
echo "Fetching Base Image" echo "Fetching Base Image"
wget $SHA256SUMS -O $IMG_PATH/SHA256SUMS.ubuntu.$RELEASE.$ARCH wget $SHA256SUMS -O $IMG_PATH/SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH
wget $CLOUD_IMAGES/$RELEASE/current/$BASE_IMAGE_FILE -O $IMG_PATH/$BASE_IMAGE_FILE.tmp wget $DIB_CLOUD_IMAGES/$DIB_RELEASE/current/$BASE_IMAGE_FILE -O $IMG_PATH/$BASE_IMAGE_FILE.tmp
pushd $IMG_PATH pushd $IMG_PATH
awk "/$BASE_IMAGE_FILE/ { print \$0 \".tmp\" }" SHA256SUMS.ubuntu.$RELEASE.$ARCH | sha256sum --check - awk "/$BASE_IMAGE_FILE/ { print \$0 \".tmp\" }" SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH | sha256sum --check -
popd popd
mv $IMG_PATH/$BASE_IMAGE_FILE.tmp $IMG_PATH/$BASE_IMAGE_FILE mv $IMG_PATH/$BASE_IMAGE_FILE.tmp $IMG_PATH/$BASE_IMAGE_FILE
fi fi