From b3e2e405c53d63bc71872d41f455507be833e7eb Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Tue, 7 May 2013 06:09:31 +0000 Subject: image_types.bbclass: remove the old images Remove the old image before the new one generated to save disk space when RM_OLD_IMAGE is set to 1, this is an easy way to keep the DEPLOY_DIR_IMAGE clean. [YOCTO #4391] Signed-off-by: Robert Yang Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- meta/classes/image_types.bbclass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'meta/classes/image_types.bbclass') diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 94837ae0a8..38647cfbc7 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -51,7 +51,11 @@ def get_imagecmds(d): types.remove("live") if d.getVar('IMAGE_LINK_NAME', True): - cmds += "\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.*" + if d.getVar('RM_OLD_IMAGE', True) == "1": + # Remove the old image + cmds += "\trm -f `find ${DEPLOY_DIR_IMAGE} -maxdepth 1 -type l -name ${IMAGE_LINK_NAME}'.*' -exec readlink -f {} \;`" + # Remove the symlink + cmds += "\n\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.*" for type in types: ccmd = [] -- cgit 1.2.3-korg