[v2,1/4] rootfs-add-files: correctly remove files in ROOTFSDIR

Message ID 20261026101018.276241-1-clara.kowalsky@siemens.com
State New
Headers show
Series [v2,1/4] rootfs-add-files: correctly remove files in ROOTFSDIR | expand

Commit Message

Clara Kowalsky Oct. 26, 2026, 10:10 a.m. UTC
The existence check uses ROOTFSDIR plus destination, but the removal
command uses destination alone. Since the task runs outside the
image chroot, it targets a build-host path instead.

Fixes: d2eb951a931c ("add new class to add files directly to the rootfs")
Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com>
---
 meta/classes-recipe/rootfs-add-files.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/meta/classes-recipe/rootfs-add-files.bbclass b/meta/classes-recipe/rootfs-add-files.bbclass
index 38f739ee..d33752f3 100644
--- a/meta/classes-recipe/rootfs-add-files.bbclass
+++ b/meta/classes-recipe/rootfs-add-files.bbclass
@@ -24,7 +24,7 @@  python rootfs_add_files() {
         destination = d.getVarFlag(additional_file_entry, "destination") or ""
         source = d.getVarFlag(additional_file_entry, "source") or ""
         if os.path.exists(f"{rootfsdir}/{destination}"):
-            bb.process.run([ "/usr/bin/rm", "-f", f"{destination}"])
+            bb.process.run(["/usr/bin/rm", "-f", f"{rootfsdir}/{destination}"])
 
         dest_dir = os.path.dirname(destination)
         bb.process.run(["sudo", "-E", "/usr/bin/mkdir", "-p", f"{rootfsdir}/{dest_dir}" ])