Skip to contentSkip to conversation

baremetal-image: fix broken symlink in do_rootfs

PATCH New Davide Gardenal 1 participant 1 message Jun 6, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 baremetal-image: fix broken symlink in do_rootfs

If IMAGE_LINK_NAME and IMAGE_MANIFEST are equal
don't create a link otherwise it will create it
to itself.

---
 meta/classes/baremetal-image.bbclass | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/classes/baremetal-image.bbclass +4 -3
index 81f5e5e93d..cb9e250350 100644
@@ -47,9 +47,10 @@ python do_rootfs(){
     Path(manifest_name).touch()
     if os.path.exists(manifest_name) and link_name:
         manifest_link = deploy_dir + "/" + link_name + ".manifest"
-        if os.path.lexists(manifest_link):
-            os.remove(manifest_link)
-        os.symlink(os.path.basename(manifest_name), manifest_link)
+        if manifest_link != manifest_name:
+            if os.path.lexists(manifest_link):
+                os.remove(manifest_link)
+            os.symlink(os.path.basename(manifest_name), manifest_link)
     # A lot of postprocess commands assume the existence of rootfs/etc
     sysconfdir = d.getVar("IMAGE_ROOTFS") + d.getVar('sysconfdir')
     bb.utils.mkdirhier(sysconfdir)
Signature · 1 line
2.32.0