overlayfs: move templates to files directory

(From OE-Core rev: b08ce6d23f2c6c89073ddff90b758360f9ce9fea)

Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Vyacheslav Yurkov 2021-12-10 14:01:45 +01:00 committed by Richard Purdie
parent 3c2b8e47e7
commit 9fc8c38658
4 changed files with 49 additions and 42 deletions

View File

@ -37,51 +37,19 @@ REQUIRED_DISTRO_FEATURES += "systemd overlayfs"
inherit systemd features_check
OVERLAYFS_CREATE_DIRS_TEMPLATE ??= "${COREBASE}/meta/files/overlayfs-create-dirs.service.in"
OVERLAYFS_MOUNT_UNIT_TEMPLATE ??= "${COREBASE}/meta/files/overlayfs-unit.mount.in"
OVERLAYFS_ALL_OVERLAYS_TEMPLATE ??= "${COREBASE}/meta/files/overlayfs-all-overlays.service.in"
python do_create_overlayfs_units() {
from oe.overlayfs import mountUnitName
CreateDirsUnitTemplate = """[Unit]
Description=Overlayfs directories setup
Requires={DATA_MOUNT_UNIT}
After={DATA_MOUNT_UNIT}
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=mkdir -p {DATA_MOUNT_POINT}/workdir{LOWERDIR} && mkdir -p {DATA_MOUNT_POINT}/upper{LOWERDIR}
RemainAfterExit=true
StandardOutput=journal
[Install]
WantedBy=multi-user.target
"""
MountUnitTemplate = """[Unit]
Description=Overlayfs mount unit
Requires={CREATE_DIRS_SERVICE}
After={CREATE_DIRS_SERVICE}
[Mount]
What=overlay
Where={LOWERDIR}
Type=overlay
Options=lowerdir={LOWERDIR},upperdir={DATA_MOUNT_POINT}/upper{LOWERDIR},workdir={DATA_MOUNT_POINT}/workdir{LOWERDIR}
[Install]
WantedBy=multi-user.target
"""
AllOverlaysTemplate = """[Unit]
Description=Groups all overlays required by {PN} in one unit
After={ALL_OVERLAYFS_UNITS}
Requires={ALL_OVERLAYFS_UNITS}
[Service]
Type=oneshot
ExecStart=/bin/true
RemainAfterExit=true
[Install]
WantedBy=local-fs.target
"""
with open(d.getVar("OVERLAYFS_CREATE_DIRS_TEMPLATE"), "r") as f:
CreateDirsUnitTemplate = f.read()
with open(d.getVar("OVERLAYFS_MOUNT_UNIT_TEMPLATE"), "r") as f:
MountUnitTemplate = f.read()
with open(d.getVar("OVERLAYFS_ALL_OVERLAYS_TEMPLATE"), "r") as f:
AllOverlaysTemplate = f.read()
def prepareUnits(data, lower):
from oe.overlayfs import helperUnitName

View File

@ -0,0 +1,12 @@
[Unit]
Description=Groups all overlays required by {PN} in one unit
After={ALL_OVERLAYFS_UNITS}
Requires={ALL_OVERLAYFS_UNITS}
[Service]
Type=oneshot
ExecStart=/bin/true
RemainAfterExit=true
[Install]
WantedBy=local-fs.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=Overlayfs directories setup
Requires={DATA_MOUNT_UNIT}
After={DATA_MOUNT_UNIT}
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=mkdir -p {DATA_MOUNT_POINT}/workdir{LOWERDIR} && mkdir -p {DATA_MOUNT_POINT}/upper{LOWERDIR}
RemainAfterExit=true
StandardOutput=journal
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
[Unit]
Description=Overlayfs mount unit
Requires={CREATE_DIRS_SERVICE}
After={CREATE_DIRS_SERVICE}
[Mount]
What=overlay
Where={LOWERDIR}
Type=overlay
Options=lowerdir={LOWERDIR},upperdir={DATA_MOUNT_POINT}/upper{LOWERDIR},workdir={DATA_MOUNT_POINT}/workdir{LOWERDIR}
[Install]
WantedBy=multi-user.target