public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] initramfs: Avoid hanging mounts on failed update-initramfs
@ 2024-10-17  7:57 Anton Mikanovich
  0 siblings, 0 replies; only message in thread
From: Anton Mikanovich @ 2024-10-17  7:57 UTC (permalink / raw)
  To: isar-users; +Cc: Anton Mikanovich

If update-initramfs fails during do_generate_initramfs task execution
there will be mounts left behind.
Protect it with a trap for cleanup in case of failure.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 meta/classes/initramfs.bbclass | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/classes/initramfs.bbclass b/meta/classes/initramfs.bbclass
index 42013356..0197a60b 100644
--- a/meta/classes/initramfs.bbclass
+++ b/meta/classes/initramfs.bbclass
@@ -35,6 +35,10 @@ do_generate_initramfs[sstate-inputdirs] = "${DEPLOYDIR}"
 do_generate_initramfs[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
 do_generate_initramfs() {
     rootfs_do_mounts
+
+    trap 'exit 1' INT HUP QUIT TERM ALRM USR1
+    trap 'rootfs_do_umounts' EXIT
+
     rootfs_do_qemu
 
     sudo -E chroot "${INITRAMFS_ROOTFS}" sh -c '\
-- 
2.34.1

-- 
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/20241017075749.101476-1-amikan%40ilbers.de.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-17  7:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-17  7:57 [PATCH] initramfs: Avoid hanging mounts on failed update-initramfs Anton Mikanovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox