From 84eea81efe5c9e521e3ec4eecfa32e590cc4a62d Mon Sep 17 00:00:00 2001 From: Roman Gorshunov Date: Tue, 15 May 2018 14:12:59 -0700 Subject: [PATCH] Allow to rebuild arbitrary images Patch allows to rebuild arbitrary images, which location, filename and sha256sum are specified in variables, not only hardcoded $DIB_RELEASE/current. Change-Id: I05418932a0c40d885fe00a49f1f49d7e86c67518 --- .../elements/ubuntu/root.d/10-cache-ubuntu-tarball | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball b/diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball index d9e5d7bc..4f7ba3ea 100755 --- a/diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball +++ b/diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball @@ -12,14 +12,14 @@ set -o pipefail shopt -s extglob -DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud-images.ubuntu.com} DIB_RELEASE=${DIB_RELEASE:-trusty} +DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud-images.ubuntu.com/$DIB_RELEASE/current} if [ $DIB_RELEASE != "trusty" ] && [ $DIB_RELEASE != "xenial" ]; then BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$DIB_RELEASE-server-cloudimg-$ARCH.squashfs} else BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$DIB_RELEASE-server-cloudimg-$ARCH-root.tar.gz} fi -SHA256SUMS=${SHA256SUMS:-https://${DIB_CLOUD_IMAGES##http?(s)://}/$DIB_RELEASE/current/SHA256SUMS} +SHA256SUMS=${SHA256SUMS:-https://${DIB_CLOUD_IMAGES##http?(s)://}/SHA256SUMS} CACHED_FILE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE CACHED_FILE_LOCK=$DIB_LOCKFILES/$BASE_IMAGE_FILE.lock CACHED_SUMS=$DIB_IMAGE_CACHE/SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH @@ -31,7 +31,7 @@ function get_ubuntu_tarball() { echo "Fetching Base Image" $TMP_HOOKS_PATH/bin/cache-url $SHA256SUMS $CACHED_SUMS $TMP_HOOKS_PATH/bin/cache-url \ - $DIB_CLOUD_IMAGES/$DIB_RELEASE/current/$BASE_IMAGE_FILE $CACHED_FILE + $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE $CACHED_FILE pushd $DIB_IMAGE_CACHE if ! grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check - ; then # It is likely that an upstream http(s) proxy has given us a skewed @@ -43,7 +43,7 @@ function get_ubuntu_tarball() { $TMP_HOOKS_PATH/bin/cache-url -f $SHA256SUMS $CACHED_SUMS if ! grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check - ; then $TMP_HOOKS_PATH/bin/cache-url -f \ - $DIB_CLOUD_IMAGES/$DIB_RELEASE/current/$BASE_IMAGE_FILE $CACHED_FILE + $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE $CACHED_FILE grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check - fi fi