From ff28239bbf73535eee46322aff982c61bf603d06 Mon Sep 17 00:00:00 2001 From: Vyacheslav Yurkov Date: Wed, 7 Sep 2022 21:51:38 +0200 Subject: classes: files: Extend overlayfs-etc class 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. (From OE-Core rev: 6ad25304abefcbe538db7745e17ac213fa7d0719) Signed-off-by: Vyacheslav Yurkov Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie (cherry picked from commit 791e8a8bacce5a7f31f4d7bcbfb17df2967fd258) Signed-off-by: Steve Sakoman Signed-off-by: Richard Purdie --- meta/files/overlayfs-etc-preinit.sh.in | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'meta/files') diff --git a/meta/files/overlayfs-etc-preinit.sh.in b/meta/files/overlayfs-etc-preinit.sh.in index 0e80849f12..8db076f4ba 100644 --- a/meta/files/overlayfs-etc-preinit.sh.in +++ b/meta/files/overlayfs-etc-preinit.sh.in @@ -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 \ -- cgit v1.2.3-54-g00ecf