Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] rootfs: run postinst ontarget on ro-rootfs when read-only-rootfs-delayed-postinsts set
@ 2024-07-15  6:35 Gassner, Tobias.ext
  2024-07-15  6:41 ` Gassner, Tobias.ext
  2024-07-23 16:00 ` Richard Purdie
  0 siblings, 2 replies; 5+ messages in thread
From: Gassner, Tobias.ext @ 2024-07-15  6:35 UTC (permalink / raw)
  To: openembedded-core

this patch will ensure that pkg_postinst_ontarget task is executed for read only rootfs when read-only-rootfs-delayed-postinsts is set as IMAGE_FEATURES. In addition to the fix, a test in meta/lib/oeqa/selftest/cases/overlayfs.py testing the fix has been implemented.

Signed-off-by: Gassner, Tobias.ext <tobias.gassner.ext@karlstorz.com>
---
 meta/lib/oe/rootfs.py                     |  4 +++
 meta/lib/oeqa/selftest/cases/overlayfs.py | 41 ++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletion(-)

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":
diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py
index e31063567b..580fbdcb9c 100644
--- a/meta/lib/oeqa/selftest/cases/overlayfs.py
+++ b/meta/lib/oeqa/selftest/cases/overlayfs.py
@@ -5,7 +5,7 @@
 #
 
 from oeqa.selftest.case import OESelftestTestCase
-from oeqa.utils.commands import bitbake, runqemu
+from oeqa.utils.commands import bitbake, runqemu, get_bb_vars
 from oeqa.core.decorator import OETestTag
 from oeqa.core.decorator.data import skipIfNotMachine
 
@@ -466,6 +466,45 @@ IMAGE_INSTALL:append = " overlayfs-user"
             line = getline_qemu(output, "Read-only file system")
             self.assertTrue(line, msg=output)
 
+    @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently")
+    def test_postinst_on_target_for_read_only_rootfs(self):
+        """
+        Summary:  The purpose of this test case is to verify that post-installation
+                  on target scripts are executed even if using read-only rootfs when
+                  read-only-rootfs-delayed-postinsts is set
+        Expected: The test files are created on first boot
+        """
+
+        import oe.path
+
+        vars = get_bb_vars(("IMAGE_ROOTFS", "sysconfdir"), "core-image-minimal")
+        sysconfdir = vars["sysconfdir"]
+        self.assertIsNotNone(sysconfdir)
+        # Need to use oe.path here as sysconfdir starts with /
+        targettestdir = os.path.join(sysconfdir, "postinst-test")
+
+        config = self.get_working_config()
+
+        args = {
+            'OVERLAYFS_INIT_OPTION': "",
+            'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': 1,
+            'OVERLAYFS_ROOTFS_TYPE': "ext4",
+            'OVERLAYFS_ETC_CREATE_MOUNT_DIRS': 1
+        }
+
+        # read-only-rootfs is already set in get_working_config()
+        config += 'EXTRA_IMAGE_FEATURES += "read-only-rootfs-delayed-postinsts"\n'
+        config += 'CORE_IMAGE_EXTRA_INSTALL = "postinst-delayed-b"\n'
+
+        self.write_config(config.format(**args))
+
+        res = bitbake('core-image-minimal')
+
+        with runqemu('core-image-minimal', image_fstype='wic') as qemu:
+            for filename in ("rootfs", "delayed-a", "delayed-b"):
+                status, output = qemu.run_serial("test -f %s && echo found" % os.path.join(targettestdir, filename))
+                self.assertIn("found", output, "%s was not present on boot" % filename)
+
     def get_working_config(self):
         return """
 # Use systemd as init manager
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] rootfs: run postinst ontarget on ro-rootfs when read-only-rootfs-delayed-postinsts set
  2024-07-15  6:35 [PATCH] rootfs: run postinst ontarget on ro-rootfs when read-only-rootfs-delayed-postinsts set Gassner, Tobias.ext
@ 2024-07-15  6:41 ` Gassner, Tobias.ext
  2024-07-23  6:39   ` Gassner, Tobias.ext
  2024-07-23 16:00 ` Richard Purdie
  1 sibling, 1 reply; 5+ messages in thread
From: Gassner, Tobias.ext @ 2024-07-15  6:41 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

after rephrasing the commit message to address patchtest issues, the patch opened this new thread. previous discussion can be found here: https://lists.openembedded.org/g/openembedded-core/topic/107118664#msg201643

( https://lists.openembedded.org/g/openembedded-core/topic/107118664#msg201643 )

[-- Attachment #2: Type: text/html, Size: 350 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] rootfs: run postinst ontarget on ro-rootfs when read-only-rootfs-delayed-postinsts set
  2024-07-15  6:41 ` Gassner, Tobias.ext
@ 2024-07-23  6:39   ` Gassner, Tobias.ext
  2024-07-23  7:04     ` [OE-core] " Alexander Kanavin
  0 siblings, 1 reply; 5+ messages in thread
From: Gassner, Tobias.ext @ 2024-07-23  6:39 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 112 bytes --]

ping on the patch. Is there anything left to do for me? If not, I would appreciate merging.

Thanks
-Tobias

[-- Attachment #2: Type: text/html, Size: 162 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core] [PATCH] rootfs: run postinst ontarget on ro-rootfs when read-only-rootfs-delayed-postinsts set
  2024-07-23  6:39   ` Gassner, Tobias.ext
@ 2024-07-23  7:04     ` Alexander Kanavin
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Kanavin @ 2024-07-23  7:04 UTC (permalink / raw)
  To: Tobias.Gassner.ext; +Cc: openembedded-core

It's in staging, so nothing needs to be done:
https://git.yoctoproject.org/poky-contrib/log/?h=abelloni/master-next

Alex

On Tue, 23 Jul 2024 at 08:39, Gassner, Tobias.ext via
lists.openembedded.org
<Tobias.Gassner.ext=karlstorz.com@lists.openembedded.org> wrote:
>
> ping on the patch. Is there anything left to do for me? If not, I would appreciate merging.
>
> Thanks
> -Tobias
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#202328): https://lists.openembedded.org/g/openembedded-core/message/202328
> Mute This Topic: https://lists.openembedded.org/mt/107227142/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core] [PATCH] rootfs: run postinst ontarget on ro-rootfs when read-only-rootfs-delayed-postinsts set
  2024-07-15  6:35 [PATCH] rootfs: run postinst ontarget on ro-rootfs when read-only-rootfs-delayed-postinsts set Gassner, Tobias.ext
  2024-07-15  6:41 ` Gassner, Tobias.ext
@ 2024-07-23 16:00 ` Richard Purdie
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2024-07-23 16:00 UTC (permalink / raw)
  To: Tobias.Gassner.ext, openembedded-core

On Mon, 2024-07-15 at 08:35 +0200, Gassner, Tobias.ext via lists.openembedded.org wrote:
> this patch will ensure that pkg_postinst_ontarget task is executed for read only rootfs when read-only-rootfs-delayed-postinsts is set as IMAGE_FEATURES. In addition to the fix, a test in meta/lib/oeqa/selftest/cases/overlayfs.py testing the fix has been implemented.

For future reference, please wrap commit messages.

In this case it was also a little hard to understand the issue from the
commit message, mainly as it didn't mention the removal of run-
postinsts after rootfs construction. I tweaked the commit message to
make that clear when I merged it.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-23 16:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-15  6:35 [PATCH] rootfs: run postinst ontarget on ro-rootfs when read-only-rootfs-delayed-postinsts set Gassner, Tobias.ext
2024-07-15  6:41 ` Gassner, Tobias.ext
2024-07-23  6:39   ` Gassner, Tobias.ext
2024-07-23  7:04     ` [OE-core] " Alexander Kanavin
2024-07-23 16:00 ` Richard Purdie

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