From patchwork Tue Jun 25 13:08:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gassner, Tobias.ext" X-Patchwork-Id: 45615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD9EBC3064D for ; Tue, 25 Jun 2024 13:08:28 +0000 (UTC) Subject: execute pkg_postinst_ontarget when read-only-rootfs-delayed-postinsts is set for a read only rootfs To: poky@lists.yoctoproject.org From: "Gassner, Tobias.ext" X-Originating-Location: CH (147.161.136.111) X-Originating-Platform: Linux Chrome 126 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Tue, 25 Jun 2024 06:08:20 -0700 Message-ID: List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 25 Jun 2024 13:08:28 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/poky/message/13391 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" 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 --- meta/lib/oe/rootfs.py | 4 ++++ 1 file changed, 4 insertions(+) -- 2.45.2 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":