diff options
| author | Gassner, Tobias.ext <tobias.gassner.ext@karlstorz.com> | 2024-07-15 08:35:11 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-23 11:54:37 +0100 |
| commit | a22bdf729a2bdf6ea327540356763811758eea66 (patch) | |
| tree | 5ececbea6bdf1231e2ed228ae16f3cdefe698c8e /meta/lib | |
| parent | a278540fc16ff4f47436549bfc745133d7d276dd (diff) | |
| download | poky-a22bdf729a2bdf6ea327540356763811758eea66.tar.gz | |
rootfs: Ensure run-postinsts is not uninstalled for read-only-rootfs-delayed-postinsts
This patch ensures that pkg_postinst_ontarget task is executed for read only rootfs when
read-only-rootfs-delayed-postinsts is set as IMAGE_FEATURES. The issue was that run-postinsts
could be uninstalled at the end of rootfs construction and that shouldn't happen for
the delayed usecase.
In addition to the fix, a test in meta/lib/oeqa/selftest/cases/overlayfs.py testing
the fix has been implemented.
(From OE-Core rev: 60f587475dda99eaa07848880058b69286b8900e)
Signed-off-by: Gassner, Tobias.ext <tobias.gassner.ext@karlstorz.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oe/rootfs.py | 4 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/overlayfs.py | 41 |
2 files changed, 44 insertions, 1 deletions
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): | |||
| 269 | self.pm.remove(["run-postinsts"]) | 269 | self.pm.remove(["run-postinsts"]) |
| 270 | 270 | ||
| 271 | image_rorfs = bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", | 271 | image_rorfs = bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", |
| 272 | True, False, self.d) and \ | ||
| 273 | not bb.utils.contains("IMAGE_FEATURES", | ||
| 274 | "read-only-rootfs-delayed-postinsts", | ||
| 272 | True, False, self.d) | 275 | True, False, self.d) |
| 276 | |||
| 273 | image_rorfs_force = self.d.getVar('FORCE_RO_REMOVE') | 277 | image_rorfs_force = self.d.getVar('FORCE_RO_REMOVE') |
| 274 | 278 | ||
| 275 | if image_rorfs or image_rorfs_force == "1": | 279 | 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 @@ | |||
| 5 | # | 5 | # |
| 6 | 6 | ||
| 7 | from oeqa.selftest.case import OESelftestTestCase | 7 | from oeqa.selftest.case import OESelftestTestCase |
| 8 | from oeqa.utils.commands import bitbake, runqemu | 8 | from oeqa.utils.commands import bitbake, runqemu, get_bb_vars |
| 9 | from oeqa.core.decorator import OETestTag | 9 | from oeqa.core.decorator import OETestTag |
| 10 | from oeqa.core.decorator.data import skipIfNotMachine | 10 | from oeqa.core.decorator.data import skipIfNotMachine |
| 11 | 11 | ||
| @@ -466,6 +466,45 @@ IMAGE_INSTALL:append = " overlayfs-user" | |||
| 466 | line = getline_qemu(output, "Read-only file system") | 466 | line = getline_qemu(output, "Read-only file system") |
| 467 | self.assertTrue(line, msg=output) | 467 | self.assertTrue(line, msg=output) |
| 468 | 468 | ||
| 469 | @skipIfNotMachine("qemux86-64", "tests are qemux86-64 specific currently") | ||
| 470 | def test_postinst_on_target_for_read_only_rootfs(self): | ||
| 471 | """ | ||
| 472 | Summary: The purpose of this test case is to verify that post-installation | ||
| 473 | on target scripts are executed even if using read-only rootfs when | ||
| 474 | read-only-rootfs-delayed-postinsts is set | ||
| 475 | Expected: The test files are created on first boot | ||
| 476 | """ | ||
| 477 | |||
| 478 | import oe.path | ||
| 479 | |||
| 480 | vars = get_bb_vars(("IMAGE_ROOTFS", "sysconfdir"), "core-image-minimal") | ||
| 481 | sysconfdir = vars["sysconfdir"] | ||
| 482 | self.assertIsNotNone(sysconfdir) | ||
| 483 | # Need to use oe.path here as sysconfdir starts with / | ||
| 484 | targettestdir = os.path.join(sysconfdir, "postinst-test") | ||
| 485 | |||
| 486 | config = self.get_working_config() | ||
| 487 | |||
| 488 | args = { | ||
| 489 | 'OVERLAYFS_INIT_OPTION': "", | ||
| 490 | 'OVERLAYFS_ETC_USE_ORIG_INIT_NAME': 1, | ||
| 491 | 'OVERLAYFS_ROOTFS_TYPE': "ext4", | ||
| 492 | 'OVERLAYFS_ETC_CREATE_MOUNT_DIRS': 1 | ||
| 493 | } | ||
| 494 | |||
| 495 | # read-only-rootfs is already set in get_working_config() | ||
| 496 | config += 'EXTRA_IMAGE_FEATURES += "read-only-rootfs-delayed-postinsts"\n' | ||
| 497 | config += 'CORE_IMAGE_EXTRA_INSTALL = "postinst-delayed-b"\n' | ||
| 498 | |||
| 499 | self.write_config(config.format(**args)) | ||
| 500 | |||
| 501 | res = bitbake('core-image-minimal') | ||
| 502 | |||
| 503 | with runqemu('core-image-minimal', image_fstype='wic') as qemu: | ||
| 504 | for filename in ("rootfs", "delayed-a", "delayed-b"): | ||
| 505 | status, output = qemu.run_serial("test -f %s && echo found" % os.path.join(targettestdir, filename)) | ||
| 506 | self.assertIn("found", output, "%s was not present on boot" % filename) | ||
| 507 | |||
| 469 | def get_working_config(self): | 508 | def get_working_config(self): |
| 470 | return """ | 509 | return """ |
| 471 | # Use systemd as init manager | 510 | # Use systemd as init manager |
