[v5,03/12] rootfs: Add isar-work directory to rootfs mounts

Message ID 20251030094451.1303871-4-Quirin.Gylstorff@siemens.com
State New
Headers show
Series Add support for dracut | expand

Commit Message

Quirin Gylstorff Oct. 30, 2025, 9:44 a.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This in preparation for dracut. `dracut` creates the initrd.img with
0600 permission. These permission makes it necessary to copy
the initrd.img from the sudo context to the deploy dir.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/rootfs.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

Patch

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 98da62fb..1f2ad80b 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -138,6 +138,12 @@  rootfs_do_mounts() {
                 mount -o bind,private '${REPO_ISAR_DIR}/${DISTRO}' '${ROOTFSDIR}/isar-apt'
         fi
 
+        if [ ! -e '$ROOTFSDIR'/isar-work ]; then
+            mkdir -p '${ROOTFSDIR}/isar-work'
+            mountpoint -q '${ROOTFSDIR}/isar-work' || \
+                mount -o bind,private '${WORKDIR}' '${ROOTFSDIR}/isar-work'
+        fi
+
         # Mount base-apt if 'ISAR_USE_CACHED_BASE_REPO' is set
         if [ "${@repr(bb.utils.to_boolean(d.getVar('ISAR_USE_CACHED_BASE_REPO')))}" = 'True' ]
         then
@@ -162,6 +168,11 @@  rootfs_do_umounts() {
             rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt
         fi
 
+        if mountpoint -q '${ROOTFSDIR}/isar-work'; then
+            umount '${ROOTFSDIR}/isar-work'
+            rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-work
+        fi
+
         if mountpoint -q '${ROOTFSDIR}/dev/pts'; then
             umount '${ROOTFSDIR}/dev/pts'
         fi