summaryrefslogtreecommitdiff
path: root/meta/classes/image-vm.bbclass
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2016-08-19 22:51:12 +1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-20 16:05:28 +0100
commit3762b42233651832c5909d7a3e873365fc0a9756 (patch)
treeec23c03afaf6cf5df0743ac5fb6000eddead3bef /meta/classes/image-vm.bbclass
parente8decd7ff553d8ac773e3aebf7c49779c82fd699 (diff)
downloadopenembedded-core-3762b42233651832c5909d7a3e873365fc0a9756.tar.gz
openembedded-core-3762b42233651832c5909d7a3e873365fc0a9756.tar.bz2
openembedded-core-3762b42233651832c5909d7a3e873365fc0a9756.zip
image-vm.bbclass: remove old images if RM_OLD_IMAGE is enabled
[YOCTO #10164] Signed-off-by: Jonathan Liu <net147@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/image-vm.bbclass')
-rw-r--r--meta/classes/image-vm.bbclass13
1 files changed, 11 insertions, 2 deletions
diff --git a/meta/classes/image-vm.bbclass b/meta/classes/image-vm.bbclass
index 72f7b4b101..bf57e2c6c5 100644
--- a/meta/classes/image-vm.bbclass
+++ b/meta/classes/image-vm.bbclass
@@ -105,8 +105,12 @@ build_boot_dd() {
dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512
cd ${DEPLOY_DIR_IMAGE}
- rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect
- ln -s ${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect
+
+ if [ "${RM_OLD_IMAGE}" = "1" ] && [ -L ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect ]; then
+ rm -f $(readlink -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect)
+ fi
+
+ ln -sf ${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect
}
python do_bootdirectdisk() {
@@ -142,6 +146,11 @@ DISK_SIGNATURE_GENERATED := "${@generate_disk_signature()}"
run_qemu_img (){
type="$1"
qemu-img convert -O $type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.$type
+
+ if [ "${RM_OLD_IMAGE}" = "1" ] && [ -L ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type ]; then
+ rm -f $(readlink -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type)
+ fi
+
ln -sf ${IMAGE_NAME}.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type
}
create_vmdk_image () {