public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Florian Bezdeka <florian.bezdeka@siemens.com>
Subject: [PATCH v2 2/3] rootfs: Provide rootfs_do_umounts
Date: Tue,  1 Oct 2024 17:13:58 +0200	[thread overview]
Message-ID: <c8fceb7009980251e7191709d808575ee279b499.1727795639.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1727795639.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

This will be used more frequently soon to avoid dangling mounts.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/classes/image.bbclass  | 28 ++--------------------------
 meta/classes/rootfs.bbclass | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index ef25df49..1414a3ee 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -393,6 +393,8 @@ python do_deploy() {
 addtask deploy before do_build after do_image
 
 do_rootfs_finalize() {
+    rootfs_do_umounts
+
     sudo -s <<'EOSUDO'
         set -e
 
@@ -406,32 +408,6 @@ do_rootfs_finalize() {
                 -maxdepth 1 -name 'qemu-*-static' -type f -delete
         fi
 
-        if mountpoint -q '${ROOTFSDIR}/isar-apt'; then
-            umount '${ROOTFSDIR}/isar-apt'
-            rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt
-        fi
-
-        if mountpoint -q '${ROOTFSDIR}/base-apt'; then
-            umount '${ROOTFSDIR}/base-apt'
-            rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt
-        fi
-
-        if mountpoint -q '${ROOTFSDIR}/dev/pts'; then
-            umount '${ROOTFSDIR}/dev/pts'
-        fi
-        if mountpoint -q '${ROOTFSDIR}/dev/shm'; then
-            umount '${ROOTFSDIR}/dev/shm'
-        fi
-        if mountpoint -q '${ROOTFSDIR}/dev'; then
-            umount '${ROOTFSDIR}/dev'
-        fi
-        if mountpoint -q '${ROOTFSDIR}/proc'; then
-            umount '${ROOTFSDIR}/proc'
-        fi
-        if mountpoint -q '${ROOTFSDIR}/sys'; then
-            umount '${ROOTFSDIR}/sys'
-        fi
-
         if [ -e "${ROOTFSDIR}/etc/apt/sources-list" ]; then
             mv "${ROOTFSDIR}/etc/apt/sources-list" \
                 "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index f0abd795..ef40cbdf 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -65,6 +65,38 @@ rootfs_do_mounts() {
 EOSUDO
 }
 
+rootfs_do_umounts() {
+    sudo -s <<'EOSUDO'
+        set -e
+        if mountpoint -q '${ROOTFSDIR}/isar-apt'; then
+            umount '${ROOTFSDIR}/isar-apt'
+            rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-apt
+        fi
+
+        if mountpoint -q '${ROOTFSDIR}/base-apt'; then
+            umount '${ROOTFSDIR}/base-apt'
+            rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt
+        fi
+
+        if mountpoint -q '${ROOTFSDIR}/dev/pts'; then
+            umount '${ROOTFSDIR}/dev/pts'
+        fi
+        if mountpoint -q '${ROOTFSDIR}/dev/shm'; then
+            umount '${ROOTFSDIR}/dev/shm'
+        fi
+        if mountpoint -q '${ROOTFSDIR}/dev'; then
+            umount '${ROOTFSDIR}/dev'
+        fi
+        if mountpoint -q '${ROOTFSDIR}/proc'; then
+            umount '${ROOTFSDIR}/proc'
+        fi
+        if mountpoint -q '${ROOTFSDIR}/sys'; then
+            umount '${ROOTFSDIR}/sys'
+        fi
+
+EOSUDO
+}
+
 rootfs_do_qemu() {
     if [ '${@repr(d.getVar('ROOTFS_ARCH') == d.getVar('HOST_ARCH'))}' = 'False' ]
     then
-- 
2.43.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/c8fceb7009980251e7191709d808575ee279b499.1727795639.git.jan.kiszka%40siemens.com.

  parent reply	other threads:[~2024-10-01 15:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 15:13 [PATCH v2 0/3] Start to address umount problems 'Jan Kiszka' via isar-users
2024-10-01 15:13 ` [PATCH v2 1/3] image: Avoid breaking the build when mounts are no longer present on umount 'Jan Kiszka' via isar-users
2024-10-01 15:13 ` 'Jan Kiszka' via isar-users [this message]
2024-10-01 15:13 ` [PATCH v2 3/3] initramfs: Add missing umounts after generation 'Jan Kiszka' via isar-users
2024-10-01 22:33 ` [PATCH v2 0/3] Start to address umount problems 'Florian Bezdeka' via isar-users

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8fceb7009980251e7191709d808575ee279b499.1727795639.git.jan.kiszka@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=florian.bezdeka@siemens.com \
    --cc=jan.kiszka@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox