From a8312db74245334f4ceeda07dd731da44799ff66 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Fri, 12 Apr 2013 14:41:32 +0100 Subject: [PATCH] Migrate cloud image URL/Release options to DIB_. This switches $CLOUD_IMAGES and $RELEASE to the DIB_ namespace so they will survive future changes to the sanitisation of the build environment. Change-Id: I7dc2aa82fb9ef452705b080cc404f41046014f20 --- elements/fedora/README.md | 7 +++++++ elements/fedora/root.d/10-fedora-cloud-image | 10 +++++----- elements/ubuntu/README.md | 7 +++++++ elements/ubuntu/root.d/10-cache-ubuntu-tarball | 14 +++++++------- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/elements/fedora/README.md b/elements/fedora/README.md index 4953b4470..be2c07624 100644 --- a/elements/fedora/README.md +++ b/elements/fedora/README.md @@ -1 +1,8 @@ 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 diff --git a/elements/fedora/root.d/10-fedora-cloud-image b/elements/fedora/root.d/10-fedora-cloud-image index cdfcb17a6..3b39eef9f 100755 --- a/elements/fedora/root.d/10-fedora-cloud-image +++ b/elements/fedora/root.d/10-fedora-cloud-image @@ -10,16 +10,16 @@ if [ 'amd64' = "$ARCH" ] ; then fi IMG_PATH=~/.cache/image-create -CLOUD_IMAGES=${CLOUD_IMAGES:-http://mattdm.fedorapeople.org/cloud-images/} -RELEASE=${RELEASE:-Fedora18} -BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$RELEASE-Cloud-$ARCH-latest.raw.tar.xz} -BASE_IMAGE_TAR=$RELEASE-Cloud-$ARCH-latest.tgz +DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://mattdm.fedorapeople.org/cloud-images/} +DIB_RELEASE=${DIB_RELEASE:-Fedora18} +BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$DIB_RELEASE-Cloud-$ARCH-latest.raw.tar.xz} +BASE_IMAGE_TAR=$DIB_RELEASE-Cloud-$ARCH-latest.tgz mkdir -p $IMG_PATH # TODO: don't cache forever. if [ ! -f $IMG_PATH/$BASE_IMAGE_FILE ] ; then 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 fi if [ ! -f $IMG_PATH/$BASE_IMAGE_TAR ] ; then diff --git a/elements/ubuntu/README.md b/elements/ubuntu/README.md index 6c6e90b4a..9c08bd757 100644 --- a/elements/ubuntu/README.md +++ b/elements/ubuntu/README.md @@ -1 +1,8 @@ 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 diff --git a/elements/ubuntu/root.d/10-cache-ubuntu-tarball b/elements/ubuntu/root.d/10-cache-ubuntu-tarball index afd110bd1..a03fafe48 100755 --- a/elements/ubuntu/root.d/10-cache-ubuntu-tarball +++ b/elements/ubuntu/root.d/10-cache-ubuntu-tarball @@ -7,19 +7,19 @@ set -e [ -n "$TARGET_ROOT" ] IMG_PATH=~/.cache/image-create -CLOUD_IMAGES=${CLOUD_IMAGES:-http://cloud-images.ubuntu.com/} -RELEASE=${RELEASE:-quantal} -BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$RELEASE-server-cloudimg-$ARCH-root.tar.gz} -SHA256SUMS=${SHA256SUMS:-https://cloud-images.ubuntu.com/$RELEASE/current/SHA256SUMS} +DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud-images.ubuntu.com/} +DIB_RELEASE=${DIB_RELEASE:-quantal} +BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$DIB_RELEASE-server-cloudimg-$ARCH-root.tar.gz} +SHA256SUMS=${SHA256SUMS:-https://${DIB_CLOUD_IMAGES##http?(s)://}/$DIB_RELEASE/current/SHA256SUMS} mkdir -p $IMG_PATH # TODO: don't cache -current forever. if [ ! -f $IMG_PATH/$BASE_IMAGE_FILE ] ; then echo "Fetching Base Image" - wget $SHA256SUMS -O $IMG_PATH/SHA256SUMS.ubuntu.$RELEASE.$ARCH - wget $CLOUD_IMAGES/$RELEASE/current/$BASE_IMAGE_FILE -O $IMG_PATH/$BASE_IMAGE_FILE.tmp + wget $SHA256SUMS -O $IMG_PATH/SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH + wget $DIB_CLOUD_IMAGES/$DIB_RELEASE/current/$BASE_IMAGE_FILE -O $IMG_PATH/$BASE_IMAGE_FILE.tmp 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 mv $IMG_PATH/$BASE_IMAGE_FILE.tmp $IMG_PATH/$BASE_IMAGE_FILE fi