diff --git a/elements/centos7/root.d/10-centos7-cloud-image b/elements/centos7/root.d/10-centos7-cloud-image index a93e45de..75e3f6d2 100755 --- a/elements/centos7/root.d/10-centos7-cloud-image +++ b/elements/centos7/root.d/10-centos7-cloud-image @@ -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 diff --git a/elements/redhat-common/bin/extract-image b/elements/redhat-common/bin/extract-image index e394cc3a..594dc91d 100755 --- a/elements/redhat-common/bin/extract-image +++ b/elements/redhat-common/bin/extract-image @@ -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