mirror of
https://git.yoctoproject.org/poky
synced 2026-04-24 03:32:13 +02:00
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 <v.yurkov@precitec.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 791e8a8bacce5a7f31f4d7bcbfb17df2967fd258) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
51 lines
1.2 KiB
Bash
51 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
echo "PREINIT: Start"
|
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
|
mount -o remount,rw /
|
|
|
|
mkdir -p /proc
|
|
mkdir -p /sys
|
|
mkdir -p /run
|
|
mkdir -p /var/run
|
|
|
|
mount -t proc proc /proc
|
|
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
|
|
LOWER_DIR=$BASE_OVERLAY_ETC_DIR/lower
|
|
|
|
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 $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 \
|
|
-o workdir=$WORK_DIR \
|
|
-o index=off,xino=off,redirect_dir=off,metacopy=off \
|
|
$UPPER_DIR /etc || \
|
|
echo "PREINIT: Mounting etc-overlay failed!"
|
|
else
|
|
echo "PREINIT: Mounting </data> failed!"
|
|
fi
|
|
|
|
echo "PREINIT: done; starting </sbin/init>"
|
|
exec {SBIN_INIT_NAME}
|