All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/7] lib/oe: add generic functions for overlayfs
@ 2021-08-06 12:06 Vyacheslav Yurkov
  2021-08-06 12:06 ` [PATCH v4 2/7] overlayfs.bbclass: generate overlayfs mount units Vyacheslav Yurkov
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Vyacheslav Yurkov @ 2021-08-06 12:06 UTC (permalink / raw)
  To: Openembedded-core; +Cc: Vyacheslav Yurkov

Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
---
 meta/lib/oe/overlayfs.py | 43 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 meta/lib/oe/overlayfs.py

diff --git a/meta/lib/oe/overlayfs.py b/meta/lib/oe/overlayfs.py
new file mode 100644
index 0000000000..21ef710509
--- /dev/null
+++ b/meta/lib/oe/overlayfs.py
@@ -0,0 +1,43 @@
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# This file contains common functions for overlayfs and its QA check
+
+# this function is based on https://github.com/systemd/systemd/blob/main/src/basic/unit-name.c
+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():
+            fileList.append(mountUnitName(path))
+            fileList.append(helperUnitName(path))
+
+    return fileList
+
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-08-06 13:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 12:06 [PATCH v4 1/7] lib/oe: add generic functions for overlayfs Vyacheslav Yurkov
2021-08-06 12:06 ` [PATCH v4 2/7] overlayfs.bbclass: generate overlayfs mount units Vyacheslav Yurkov
2021-08-06 13:00   ` [OE-core] " Michael Opdenacker
2021-08-06 13:04     ` Richard Purdie
2021-08-06 13:13       ` Vyacheslav Yurkov
2021-08-06 13:28         ` Michael Opdenacker
2021-08-06 12:06 ` [PATCH v4 3/7] rootfs-postcommands: add QA check for overlayfs Vyacheslav Yurkov
2021-08-06 12:06 ` [PATCH v4 4/7] systemd-machine-units: add bbappend for meta-selftest Vyacheslav Yurkov
2021-08-06 12:06 ` [PATCH v4 5/7] overlayfs: meta-selftest recipe Vyacheslav Yurkov
2021-08-06 12:06 ` [PATCH v4 6/7] oeqa/selftest: overlayfs unit tests Vyacheslav Yurkov
2021-08-06 12:06 ` [PATCH v4 7/7] MAINTAINERS: add overlayfs maintainer Vyacheslav Yurkov
2021-08-06 13:01   ` [OE-core] " Michael Opdenacker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.