execute pkg_postinst_ontarget when read-only-rootfs-delayed-postinsts is set for a read only rootfs
"Gassner, Tobias.ext" <[email protected]>
| Newsgroups | org.yoctoproject.lists.poky |
|---|---|
| Message-ID | <[email protected]> |
Hi,
we specify read-only-rootfs and use an overlayFS to "make the roofts writable". We also want to execute a postinstall script for our package on the target:
pkg_postinst_ontarget: ${PN} () {
#some code...
}
in order for bitbake to not complain that a read-only rootfs and pkg_postinst_ontarget don't work together, we also specify read-only-rootfs-delayed-postinsts ( https://docs.yoctoproject.org/dev/ref-manual/features.html )
However, it seems that the run-postinsts package is removed by the _uninstall_unneeded function (in file meta/lib/oe/rootfs.py), because the image_rorfs flag only checks for read-only-rootfs and not for read-only-rootfs-delayed-postinsts as well. Hence, the postinst code is not executed.
When I use the fix at the end of this post, the behavior is as expected. However, I am not an expert in this area of the project and want to collect your feedback first, before proposing to merge.
PS: a pointer to read-only-rootfs-delayed-postinsts in the docu ( https://docs.yoctoproject.org/dev/dev-manual/read-only-rootfs.html#post-installation-scripts-and-read-only-root-filesystem ) would be very helpful.
Best regards
-Tobias
From 608050984c5be67f506a0877fadbbe0b61575e54 Mon Sep 17 00:00:00 2001
From: "Gassner, Tobias.ext" <[email protected]>
Date: Tue, 25 Jun 2024 13:30:17 +0200
Subject: [PATCH] keep delayed-postinsts when
read-only-rootfs-delayed-postinsts is set for a read only rootfs
Signed-off-by: Gassner, Tobias.ext <[email protected]>
---
meta/lib/oe/rootfs.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 8cd48f9450..5abce4ad7d 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -269,7 +269,11 @@ class Rootfs(object, metaclass=ABCMeta):
self.pm.remove(["run-postinsts"])
image_rorfs = bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs",
+ True, False, self.d) and \
+ not bb.utils.contains("IMAGE_FEATURES",
+ "read-only-rootfs-delayed-postinsts",
True, False, self.d)
+
image_rorfs_force = self.d.getVar('FORCE_RO_REMOVE')
if image_rorfs or image_rorfs_force == "1":
--
2.45.2