blob: 21ef710509860b19e7034abdd4bf7459c8efee48 [file] [log] [blame]
# SPDX-License-Identifier: GPL-2.0-only
# This file contains common functions for overlayfs and its QA check
# this function is based on
def escapeSystemdUnitName(path):
escapeMap = {
'/': '-',
'-': "\\x2d",
'\\': "\\x5d"
return "".join([escapeMap.get(c, c) for c in path.strip('/')])
def strForBash(s):
return s.replace('\\', '\\\\')
def mountUnitName(unit):
return escapeSystemdUnitName(unit) + '.mount'
def helperUnitName(unit):
return escapeSystemdUnitName(unit) + '-create-upper-dir.service'
def unitFileList(d):
fileList = []
overlayMountPoints = d.getVarFlags("OVERLAYFS_MOUNT_POINT")
if not overlayMountPoints:
bb.fatal("A recipe uses overlayfs class but there is no OVERLAYFS_MOUNT_POINT set in your MACHINE configuration")
# check that we have required mount points set first
requiredMountPoints = d.getVarFlags('OVERLAYFS_WRITABLE_PATHS')
for mountPoint in requiredMountPoints:
if mountPoint not in overlayMountPoints:
bb.fatal("Missing required mount point for OVERLAYFS_MOUNT_POINT[%s] in your MACHINE configuration" % mountPoint)
for mountPoint in overlayMountPoints:
for path in d.getVarFlag('OVERLAYFS_WRITABLE_PATHS', mountPoint).split():
return fileList