Patchwork [3/3] image-vmdk: Fix error recreating symbolic link

login
register
mail settings
Submitter Jonathan Liu
Date May 9, 2013, 3:24 a.m.
Message ID <1368069844-13706-3-git-send-email-net147@gmail.com>
Download mbox | patch
Permalink /patch/49607/
State Superseded, archived
Headers show

Comments

Jonathan Liu - May 9, 2013, 3:24 a.m.
If the vmdk image symbolic link already exists from a previous build,
overwrite it instead of returning an error.

Signed-off-by: Jonathan Liu <net147@gmail.com>
---
 meta/classes/image-vmdk.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Robert Yang - May 9, 2013, 8:33 a.m.
On 05/09/2013 11:24 AM, Jonathan Liu wrote:
> If the vmdk image symbolic link already exists from a previous build,
> overwrite it instead of returning an error.
>
> Signed-off-by: Jonathan Liu <net147@gmail.com>
> ---
>   meta/classes/image-vmdk.bbclass | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/image-vmdk.bbclass b/meta/classes/image-vmdk.bbclass
> index 6f7df3f..c225bed 100644
> --- a/meta/classes/image-vmdk.bbclass
> +++ b/meta/classes/image-vmdk.bbclass
> @@ -18,8 +18,8 @@ inherit boot-directdisk
>
>   create_vmdk_image () {
>   	qemu-img convert -O vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk
> +	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk
>   	ln -s ${IMAGE_NAME}.vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk

How about "ln -sf", the '-f' will remove existing destination files.

// Robert

> -
>   }
>
>   python do_vmdkimg() {
>
Jonathan Liu - May 9, 2013, 11:59 a.m.
On 9/05/2013 6:33 PM, Robert Yang wrote:
>
>
> On 05/09/2013 11:24 AM, Jonathan Liu wrote:
>> If the vmdk image symbolic link already exists from a previous build,
>> overwrite it instead of returning an error.
>>
>> Signed-off-by: Jonathan Liu <net147@gmail.com>
>> ---
>>   meta/classes/image-vmdk.bbclass | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/meta/classes/image-vmdk.bbclass 
>> b/meta/classes/image-vmdk.bbclass
>> index 6f7df3f..c225bed 100644
>> --- a/meta/classes/image-vmdk.bbclass
>> +++ b/meta/classes/image-vmdk.bbclass
>> @@ -18,8 +18,8 @@ inherit boot-directdisk
>>
>>   create_vmdk_image () {
>>       qemu-img convert -O vmdk 
>> ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect 
>> ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk
>> +    rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk
>>       ln -s ${IMAGE_NAME}.vmdk 
>> ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk
>
> How about "ln -sf", the '-f' will remove existing destination files.
>
> // Robert
Done.
>
>> -
>>   }
>>
>>   python do_vmdkimg() {
>>
Regards,
Jonathan

Patch

diff --git a/meta/classes/image-vmdk.bbclass b/meta/classes/image-vmdk.bbclass
index 6f7df3f..c225bed 100644
--- a/meta/classes/image-vmdk.bbclass
+++ b/meta/classes/image-vmdk.bbclass
@@ -18,8 +18,8 @@  inherit boot-directdisk
 
 create_vmdk_image () {
 	qemu-img convert -O vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk
+	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk
 	ln -s ${IMAGE_NAME}.vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk
-
 }
 
 python do_vmdkimg() {