Update the Fedora element to honour --offline.
Similar to the Ubuntu element the Fedora element had not been updated to honour --offline. Also similarly we only check for the existence of the final cached file rather than the image we directly download, because they are generated separately. The -u change is just hygiene to detect future buggy changes. Change-Id: Ib92a9d419bb485c8861da041066827e8d6aac0b7
This commit is contained in:
parent
d7379df8b8
commit
b8d08006db
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -eu
|
||||
|
||||
[ -n "$ARCH" ]
|
||||
[ -n "$TARGET_ROOT" ]
|
||||
@ -14,12 +14,16 @@ DIB_RELEASE=${DIB_RELEASE:-latest}
|
||||
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.fedoraproject.org}
|
||||
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-fedora-$DIB_RELEASE.$ARCH.qcow2}
|
||||
BASE_IMAGE_TAR=$DIB_RELEASE-Cloud-$ARCH-latest.tgz
|
||||
CACHED_TAR=$IMG_PATH/$BASE_IMAGE_TAR
|
||||
|
||||
echo "Fetching Base Image"
|
||||
$TMP_HOOKS_PATH/bin/cache-url $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE $IMG_PATH/$BASE_IMAGE_FILE
|
||||
if [ -n "$DIB_OFFLINE" -a -f "$CACHED_TAR" ] ; then
|
||||
echo "Not checking freshness of cached $CACHED_TAR."
|
||||
else
|
||||
echo "Fetching Base Image"
|
||||
$TMP_HOOKS_PATH/bin/cache-url $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE $IMG_PATH/$BASE_IMAGE_FILE
|
||||
|
||||
if [ ! -f $IMG_PATH/$BASE_IMAGE_TAR -o \
|
||||
$IMG_PATH/$BASE_IMAGE_FILE -nt $IMG_PATH/$BASE_IMAGE_TAR ] ; then
|
||||
if [ ! -f $CACHED_TAR -o \
|
||||
$IMG_PATH/$BASE_IMAGE_FILE -nt $CACHED_TAR ] ; then
|
||||
echo "Repacking base image as tarball."
|
||||
WORKING=$(mktemp -d)
|
||||
EACTION="rm -r $WORKING"
|
||||
@ -53,6 +57,7 @@ if [ ! -f $IMG_PATH/$BASE_IMAGE_TAR -o \
|
||||
# Chroot in so that we get the correct uid/gid
|
||||
sudo chroot $WORKING/mnt bin/tar -cz . > $WORKING/tmp.tar
|
||||
mv $WORKING/tmp.tar $IMG_PATH/$BASE_IMAGE_TAR
|
||||
fi
|
||||
fi
|
||||
# Extract the base image
|
||||
sudo tar -C $TARGET_ROOT -xzf $IMG_PATH/$BASE_IMAGE_TAR
|
||||
|
Loading…
Reference in New Issue
Block a user