mirror of
https://git.yoctoproject.org/poky
synced 2026-05-02 00:32:12 +02:00
classes: rootfs-postcommands: include /etc/fstab in overlayfs_qa_check
The systemd init manager support mount point configuration via mount units and /etc/fstab. 'Mounts listed in /etc/fstab will be converted into native units dynamically at boot and when the configuration of the system manager is reloaded. In general, configuring mount points through /etc/fstab is the preferred approach.' [1] Read mount points from /etc/fstab to determine dynamic mount units. [1] https://www.freedesktop.org/software/systemd/man/systemd.mount.html (From OE-Core rev: 9db988dae6dbf6da7b066728bc13b59a5c45b75c) Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
b78f8b7cfa
commit
2126584d61
@@ -372,25 +372,45 @@ rootfs_reproducible () {
|
||||
fi
|
||||
}
|
||||
|
||||
# Perform a dumb check for unit existence, not its validity
|
||||
python overlayfs_qa_check() {
|
||||
from oe.overlayfs import mountUnitName
|
||||
|
||||
# this is a dumb check for unit existence, not its validity
|
||||
overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT") or {}
|
||||
imagepath = d.getVar("IMAGE_ROOTFS")
|
||||
searchpaths = [oe.path.join(imagepath, d.getVar("sysconfdir"), "systemd", "system"),
|
||||
sysconfdir = d.getVar("sysconfdir")
|
||||
searchpaths = [oe.path.join(imagepath, sysconfdir, "systemd", "system"),
|
||||
oe.path.join(imagepath, d.getVar("systemd_system_unitdir"))]
|
||||
fstabpath = oe.path.join(imagepath, sysconfdir, "fstab")
|
||||
|
||||
if not any(os.path.exists(path) for path in [*searchpaths, fstabpath]):
|
||||
return
|
||||
|
||||
fstabDevices = []
|
||||
if os.path.isfile(fstabpath):
|
||||
with open(fstabpath, 'r') as f:
|
||||
for line in f:
|
||||
if line[0] == '#':
|
||||
continue
|
||||
path = line.split(maxsplit=2)
|
||||
if len(path) > 2:
|
||||
fstabDevices.append(path[1])
|
||||
|
||||
allUnitExist = True;
|
||||
for mountPoint in overlayMountPoints:
|
||||
path = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint)
|
||||
unit = mountUnitName(path)
|
||||
mountPath = d.getVarFlag('OVERLAYFS_MOUNT_POINT', mountPoint)
|
||||
if mountPath in fstabDevices:
|
||||
continue
|
||||
|
||||
if not any(os.path.isfile(oe.path.join(dirpath, unit))
|
||||
for dirpath in searchpaths):
|
||||
bb.warn('Unit name %s not found in systemd unit directories' % unit)
|
||||
allUnitExist = False;
|
||||
mountUnit = mountUnitName(mountPath)
|
||||
if any(os.path.isfile(oe.path.join(dirpath, mountUnit))
|
||||
for dirpath in searchpaths):
|
||||
continue
|
||||
|
||||
bb.warn('Mount path %s not found in fstat and unit %s not found '
|
||||
'in systemd unit directories' % (mountPath, mountUnit))
|
||||
allUnitExist = False;
|
||||
|
||||
if not allUnitExist:
|
||||
bb.fatal('Not all mount units are installed by the BSP')
|
||||
bb.fatal('Not all mount paths and units are installed in the image')
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ DISTRO_FEATURES += "systemd overlayfs"
|
||||
self.add_overlay_conf_to_machine()
|
||||
|
||||
res = bitbake('core-image-minimal', ignore_status=True)
|
||||
line = getline(res, "Unit name mnt-overlay.mount not found in systemd unit directories")
|
||||
line = getline(res, " Mount path /mnt/overlay not found in fstat and unit mnt-overlay.mount not found in systemd unit directories")
|
||||
self.assertTrue(line and line.startswith("WARNING:"), msg=res.output)
|
||||
line = getline(res, "Not all mount units are installed by the BSP")
|
||||
line = getline(res, "Not all mount paths and units are installed in the image")
|
||||
self.assertTrue(line and line.startswith("ERROR:"), msg=res.output)
|
||||
|
||||
def test_mount_unit_not_set(self):
|
||||
|
||||
Reference in New Issue
Block a user