[v7,03/13] rootfs: Add isar-work directory to rootfs mounts

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

Commit Message

Quirin Gylstorff Nov. 5, 2025, 12:12 p.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 b295a99e..c683d5d2 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -139,6 +139,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
@@ -163,6 +169,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