oeqa/selftest: drop image_feature test from overlayfs
PATCH 1/5 oeqa/selftest: drop image_feature test from overlayfs
From: Vyacheslav Yurkov <[email protected]>
The test checked the incorrect class use with INHERIT. This functionality is now covered by bitbake
--- meta/lib/oeqa/selftest/cases/overlayfs.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
meta/lib/oeqa/selftest/cases/overlayfs.py +1 -12
@@ -333,24 +333,14 @@ EXTRA_IMAGE_FEATURES += "package-management" self.assertTrue("overlayfs-etc" in res.output, msg=res.output) self.assertTrue("package-management" in res.output, msg=res.output) - def test_image_feature_is_missing_class_included(self): - configAppend = """ -INHERIT += "overlayfs-etc" -""" - self.run_check_image_feature(configAppend) - def test_image_feature_is_missing(self): - self.run_check_image_feature() - - def run_check_image_feature(self, appendToConfig=""): """ Summary: Overlayfs-etc class is not applied when image feature is not set - even if we inherit it directly, Expected: Image is created successfully but /etc is not an overlay Author: Vyacheslav Yurkov <[email protected]> """ - config = f""" + config = """ DISTRO_FEATURES:append = " systemd" # Use systemd as init manager
@@ -366,7 +356,6 @@ EXTRA_IMAGE_FEATURES += "read-only-rootfs" # Image configuration for overlayfs-etc OVERLAYFS_ETC_MOUNT_POINT = "/data" OVERLAYFS_ETC_DEVICE = "/dev/sda3" -{appendToConfig} """ self.write_config(config)
Signature · 1 line
2.30.2
PATCH 2/5 classes: Update overlayfs classes to use new bitbake functionality
From: Vyacheslav Yurkov <[email protected]>
OverlayFS classes belong to a recipe scope
---
meta/{classes => classes-recipe}/overlayfs-etc.bbclass | 0
meta/{classes => classes-recipe}/overlayfs.bbclass | 0
2 files changed, 0 insertions(+), 0 deletions(-)
rename meta/{classes => classes-recipe}/overlayfs-etc.bbclass (100%)
rename meta/{classes => classes-recipe}/overlayfs.bbclass (100%)meta/classes-recipe/overlayfs-etc.bbclass renamed from meta/classes/overlayfs-etc.bbclass +0 -0
meta/classes-recipe/overlayfs.bbclass renamed from meta/classes/overlayfs.bbclass +0 -0
Signature · 1 line
2.30.2
PATCH 3/5 files: overlayfs-etc: refactor preinit template
In reply to Vyacheslav YurkovFrom: Vyacheslav Yurkov <[email protected]>
--- meta/files/overlayfs-etc-preinit.sh.in | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
meta/files/overlayfs-etc-preinit.sh.in +9 -5
@@ -15,19 +15,23 @@ mount -t sysfs sysfs /sys [ -z "$CONSOLE" ] && CONSOLE="/dev/console" +BASE_OVERLAY_ETC_DIR={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc +UPPER_DIR=$BASE_OVERLAY_ETC_DIR/upper +WORK_DIR=$BASE_OVERLAY_ETC_DIR/work + mkdir -p {OVERLAYFS_ETC_MOUNT_POINT} if mount -n -t {OVERLAYFS_ETC_FSTYPE} \ -o {OVERLAYFS_ETC_MOUNT_OPTIONS} \ {OVERLAYFS_ETC_DEVICE} {OVERLAYFS_ETC_MOUNT_POINT} then - mkdir -p {OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper - mkdir -p {OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/work + mkdir -p $UPPER_DIR + mkdir -p $WORK_DIR mount -n -t overlay \ - -o upperdir={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper \ + -o upperdir=$UPPER_DIR \ -o lowerdir=/etc \ - -o workdir={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/work \ + -o workdir=$WORK_DIR \ -o index=off,xino=off,redirect_dir=off,metacopy=off \ - {OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc/upper /etc || \ + $UPPER_DIR /etc || \ echo "PREINIT: Mounting etc-overlay failed!" else echo "PREINIT: Mounting </data> failed!"
Signature · 1 line
2.30.2
PATCH 4/5 classes: files: Extend overlayfs-etc class
In reply to Vyacheslav YurkovFrom: Vyacheslav Yurkov <[email protected]>
Add the ability to expose the lower layer of /etc when mounting overlay. This is the similar to what overlayroot script from initramfs-framework does.
By default, this option is turned off to keep an old behavior intact.
--- meta/classes-recipe/overlayfs-etc.bbclass | 5 ++++- meta/files/overlayfs-etc-preinit.sh.in | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
meta/classes-recipe/overlayfs-etc.bbclass +4 -1
@@ -40,6 +40,7 @@ OVERLAYFS_ETC_DEVICE ??= "" OVERLAYFS_ETC_USE_ORIG_INIT_NAME ??= "1" OVERLAYFS_ETC_MOUNT_OPTIONS ??= "defaults" OVERLAYFS_ETC_INIT_TEMPLATE ??= "${COREBASE}/meta/files/overlayfs-etc-preinit.sh.in" +OVERLAYFS_ETC_EXPOSE_LOWER ??= "0" python create_overlayfs_etc_preinit() { overlayEtcMountPoint = d.getVar("OVERLAYFS_ETC_MOUNT_POINT")
@@ -60,13 +61,15 @@ python create_overlayfs_etc_preinit() { preinitPath = oe.path.join(d.getVar("IMAGE_ROOTFS"), d.getVar("base_sbindir"), "preinit") initBaseName = oe.path.join(d.getVar("base_sbindir"), "init") origInitNameSuffix = ".orig" + exposeLower = oe.types.boolean(d.getVar('OVERLAYFS_ETC_EXPOSE_LOWER')) args = { 'OVERLAYFS_ETC_MOUNT_POINT': overlayEtcMountPoint, 'OVERLAYFS_ETC_MOUNT_OPTIONS': d.getVar('OVERLAYFS_ETC_MOUNT_OPTIONS'), 'OVERLAYFS_ETC_FSTYPE': overlayEtcFsType, 'OVERLAYFS_ETC_DEVICE': overlayEtcDevice, - 'SBIN_INIT_NAME': initBaseName + origInitNameSuffix if useOrigInit else initBaseName + 'SBIN_INIT_NAME': initBaseName + origInitNameSuffix if useOrigInit else initBaseName, + 'OVERLAYFS_ETC_EXPOSE_LOWER': "true" if exposeLower else "false" } if useOrigInit:
meta/files/overlayfs-etc-preinit.sh.in +9 -0
@@ -18,6 +18,7 @@ mount -t sysfs sysfs /sys BASE_OVERLAY_ETC_DIR={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc UPPER_DIR=$BASE_OVERLAY_ETC_DIR/upper WORK_DIR=$BASE_OVERLAY_ETC_DIR/work +LOWER_DIR=$BASE_OVERLAY_ETC_DIR/lower mkdir -p {OVERLAYFS_ETC_MOUNT_POINT} if mount -n -t {OVERLAYFS_ETC_FSTYPE} \
@@ -26,6 +27,14 @@ if mount -n -t {OVERLAYFS_ETC_FSTYPE} \ then mkdir -p $UPPER_DIR mkdir -p $WORK_DIR + + if {OVERLAYFS_ETC_EXPOSE_LOWER}; then + mkdir -p $LOWER_DIR + + # provide read-only access to original /etc content + mount -o bind,ro /etc $LOWER_DIR + fi + mount -n -t overlay \ -o upperdir=$UPPER_DIR \ -o lowerdir=/etc \
Signature · 1 line
2.30.2
PATCH 5/5 oeqa/selftest: Add lower layer test for overlayfs-etc
In reply to Vyacheslav YurkovFrom: Vyacheslav Yurkov <[email protected]>
Place a test file on the /etc by means of overlayfs-user recipe. Perform QA checks to make sure that:
- When lower layer is exposed, that it's read-only to avoid undefined behavior
- By default lower layer is not exposed
--- .../overlayfs-user/overlayfs-user.bb | 7 +- meta/lib/oeqa/selftest/cases/overlayfs.py | 90 ++++++++++++++----- 2 files changed, 74 insertions(+), 23 deletions(-)
meta-selftest/recipes-test/overlayfs-user/overlayfs-user.bb +6 -1
@@ -12,6 +12,11 @@ OVERLAYFS_WRITABLE_PATHS[mnt-overlay] += "/usr/share/my-application" do_install() { install -d ${D}/usr/share/my-application + install -d ${D}${sysconfdir} + echo "Original file in /etc" >> ${D}${sysconfdir}/lower-layer-test.txt } -FILES:${PN} += "/usr" +FILES:${PN} += "\ + ${exec_prefix} \ + ${sysconfdir \ +"
meta/lib/oeqa/selftest/cases/overlayfs.py +68 -22
105 lines not on this page · raw message
Signature · 1 line
2.30.2