diff options
-rw-r--r-- | meta/classes-recipe/overlayfs-etc.bbclass | 5 | ||||
-rw-r--r-- | meta/files/overlayfs-etc-preinit.sh.in | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/meta/classes-recipe/overlayfs-etc.bbclass b/meta/classes-recipe/overlayfs-etc.bbclass index d0bc3ecfac..f8343106f3 100644 --- a/meta/classes-recipe/overlayfs-etc.bbclass +++ b/meta/classes-recipe/overlayfs-etc.bbclass | |||
@@ -40,6 +40,7 @@ OVERLAYFS_ETC_DEVICE ??= "" | |||
40 | OVERLAYFS_ETC_USE_ORIG_INIT_NAME ??= "1" | 40 | OVERLAYFS_ETC_USE_ORIG_INIT_NAME ??= "1" |
41 | OVERLAYFS_ETC_MOUNT_OPTIONS ??= "defaults" | 41 | OVERLAYFS_ETC_MOUNT_OPTIONS ??= "defaults" |
42 | OVERLAYFS_ETC_INIT_TEMPLATE ??= "${COREBASE}/meta/files/overlayfs-etc-preinit.sh.in" | 42 | OVERLAYFS_ETC_INIT_TEMPLATE ??= "${COREBASE}/meta/files/overlayfs-etc-preinit.sh.in" |
43 | OVERLAYFS_ETC_EXPOSE_LOWER ??= "0" | ||
43 | 44 | ||
44 | python create_overlayfs_etc_preinit() { | 45 | python create_overlayfs_etc_preinit() { |
45 | overlayEtcMountPoint = d.getVar("OVERLAYFS_ETC_MOUNT_POINT") | 46 | overlayEtcMountPoint = d.getVar("OVERLAYFS_ETC_MOUNT_POINT") |
@@ -60,13 +61,15 @@ python create_overlayfs_etc_preinit() { | |||
60 | preinitPath = oe.path.join(d.getVar("IMAGE_ROOTFS"), d.getVar("base_sbindir"), "preinit") | 61 | preinitPath = oe.path.join(d.getVar("IMAGE_ROOTFS"), d.getVar("base_sbindir"), "preinit") |
61 | initBaseName = oe.path.join(d.getVar("base_sbindir"), "init") | 62 | initBaseName = oe.path.join(d.getVar("base_sbindir"), "init") |
62 | origInitNameSuffix = ".orig" | 63 | origInitNameSuffix = ".orig" |
64 | exposeLower = oe.types.boolean(d.getVar('OVERLAYFS_ETC_EXPOSE_LOWER')) | ||
63 | 65 | ||
64 | args = { | 66 | args = { |
65 | 'OVERLAYFS_ETC_MOUNT_POINT': overlayEtcMountPoint, | 67 | 'OVERLAYFS_ETC_MOUNT_POINT': overlayEtcMountPoint, |
66 | 'OVERLAYFS_ETC_MOUNT_OPTIONS': d.getVar('OVERLAYFS_ETC_MOUNT_OPTIONS'), | 68 | 'OVERLAYFS_ETC_MOUNT_OPTIONS': d.getVar('OVERLAYFS_ETC_MOUNT_OPTIONS'), |
67 | 'OVERLAYFS_ETC_FSTYPE': overlayEtcFsType, | 69 | 'OVERLAYFS_ETC_FSTYPE': overlayEtcFsType, |
68 | 'OVERLAYFS_ETC_DEVICE': overlayEtcDevice, | 70 | 'OVERLAYFS_ETC_DEVICE': overlayEtcDevice, |
69 | 'SBIN_INIT_NAME': initBaseName + origInitNameSuffix if useOrigInit else initBaseName | 71 | 'SBIN_INIT_NAME': initBaseName + origInitNameSuffix if useOrigInit else initBaseName, |
72 | 'OVERLAYFS_ETC_EXPOSE_LOWER': "true" if exposeLower else "false" | ||
70 | } | 73 | } |
71 | 74 | ||
72 | if useOrigInit: | 75 | if useOrigInit: |
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 | |||
18 | BASE_OVERLAY_ETC_DIR={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc | 18 | BASE_OVERLAY_ETC_DIR={OVERLAYFS_ETC_MOUNT_POINT}/overlay-etc |
19 | UPPER_DIR=$BASE_OVERLAY_ETC_DIR/upper | 19 | UPPER_DIR=$BASE_OVERLAY_ETC_DIR/upper |
20 | WORK_DIR=$BASE_OVERLAY_ETC_DIR/work | 20 | WORK_DIR=$BASE_OVERLAY_ETC_DIR/work |
21 | LOWER_DIR=$BASE_OVERLAY_ETC_DIR/lower | ||
21 | 22 | ||
22 | mkdir -p {OVERLAYFS_ETC_MOUNT_POINT} | 23 | mkdir -p {OVERLAYFS_ETC_MOUNT_POINT} |
23 | if mount -n -t {OVERLAYFS_ETC_FSTYPE} \ | 24 | if mount -n -t {OVERLAYFS_ETC_FSTYPE} \ |
@@ -26,6 +27,14 @@ if mount -n -t {OVERLAYFS_ETC_FSTYPE} \ | |||
26 | then | 27 | then |
27 | mkdir -p $UPPER_DIR | 28 | mkdir -p $UPPER_DIR |
28 | mkdir -p $WORK_DIR | 29 | mkdir -p $WORK_DIR |
30 | |||
31 | if {OVERLAYFS_ETC_EXPOSE_LOWER}; then | ||
32 | mkdir -p $LOWER_DIR | ||
33 | |||
34 | # provide read-only access to original /etc content | ||
35 | mount -o bind,ro /etc $LOWER_DIR | ||
36 | fi | ||
37 | |||
29 | mount -n -t overlay \ | 38 | mount -n -t overlay \ |
30 | -o upperdir=$UPPER_DIR \ | 39 | -o upperdir=$UPPER_DIR \ |
31 | -o lowerdir=/etc \ | 40 | -o lowerdir=/etc \ |