Update to newer Centos7 images
Update to newer Centos7 images as announced at [1]. Changes included: * update to GA image * respect TMP_DIR for image working directory * use suffix-match rather than prefix-match to build RAW_IMAGE name to be more robust against weird names * partition layout work-arounds not needed any-more, all one partition. Resulting image booted locally with kvm and virtualbox (after conversion to vdi) [1] https://www.redhat.com/archives/rdo-list/2014-August/msg00045.html Closes-Bug: #1363146 Change-Id: Ie24033468b78587ea87188ee1b843b26895798ff
This commit is contained in:
parent
f4011996ee
commit
45afb6d86c
@ -20,9 +20,9 @@ if [ -n "$DIB_LOCAL_IMAGE" ]; then
|
||||
BASE_IMAGE_FILE=$(basename $DIB_LOCAL_IMAGE)
|
||||
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
|
||||
else
|
||||
DIB_RELEASE=${DIB_RELEASE:-Broken-20140620-Nightly}
|
||||
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://buildlogs.centos.org/centos/7/cloud}
|
||||
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-7-$DIB_RELEASE.qcow2}
|
||||
DIB_RELEASE=${DIB_RELEASE:-GenericCloud-GA-7.0.1406_01}
|
||||
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/centos/7/devel}
|
||||
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-7-x86_64-$DIB_RELEASE.qcow2}
|
||||
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
|
||||
IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE
|
||||
CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
|
||||
|
@ -40,21 +40,18 @@ function extract_image() {
|
||||
if [ ! -f $CACHED_TAR -o \
|
||||
$CACHED_IMAGE -nt $CACHED_TAR ] ; then
|
||||
echo "Repacking base image as tarball."
|
||||
WORKING=$(mktemp -d)
|
||||
|
||||
WORKING=$(mktemp --tmpdir=${TMP_DIR:-/tmp} -d)
|
||||
EACTION="rm -r $WORKING"
|
||||
trap "$EACTION" EXIT
|
||||
echo "Working in $WORKING"
|
||||
|
||||
RAW_FILE=$(basename $BASE_IMAGE_FILE)
|
||||
RAW_FILE=${RAW_FILE#.qcow2}.raw
|
||||
RAW_FILE=${RAW_FILE%.qcow2}.raw
|
||||
|
||||
qemu-img convert -f qcow2 -O raw $CACHED_IMAGE $WORKING/$RAW_FILE
|
||||
|
||||
# F19 images have the rootfs partition on p1
|
||||
# Centos7 images on p3 (p1 boot, p2 swap)
|
||||
if [[ $DISTRO_NAME = "centos7" ]]; then
|
||||
ROOT_PARTITON=p3
|
||||
else
|
||||
ROOT_PARTITON=p1
|
||||
fi
|
||||
ROOT_PARTITON=p1
|
||||
|
||||
# kpartx fails if no /dev/loop* exists, "losetup -f" prints first unused
|
||||
# loop device and creates it if it doesn't exist
|
||||
@ -75,15 +72,6 @@ function extract_image() {
|
||||
EACTION="sudo umount -f $WORKING/mnt ; $EACTION"
|
||||
trap "$EACTION" EXIT
|
||||
|
||||
# need to copy the contents of /boot into the image too, so
|
||||
# mount it
|
||||
if [[ $DISTRO_NAME = "centos7" ]]; then
|
||||
BOOT_LOOPDEV=${ROOT_LOOPDEV/p3/p1}
|
||||
sudo mount /dev/mapper/$BOOT_LOOPDEV $WORKING/mnt/boot
|
||||
EACTION="sudo umount -f $WORKING/mnt/boot ; $EACTION"
|
||||
trap "$EACTION" EXIT
|
||||
fi
|
||||
|
||||
# Chroot in so that we get the correct uid/gid
|
||||
sudo chroot $WORKING/mnt bin/tar -cz . > $WORKING/tmp.tar
|
||||
mv $WORKING/tmp.tar $CACHED_TAR
|
||||
|
Loading…
Reference in New Issue
Block a user