From 4cfcd4448049ca5f168b516a4a63d9e532c0a9bd Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Sun, 29 Mar 2020 14:40:54 +0200 Subject: [PATCH] stages/ostree: mode support for mount points The list of mount points is changed from a list of strings to a list of objects containing `path` and an optional `mode` value. The latter can be used to set the mode of the mount point that will be created in the file system tree. It defaults to 0755, or 493 in decimal, because JSON does not support octal values. --- stages/org.osbuild.ostree | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/stages/org.osbuild.ostree b/stages/org.osbuild.ostree index ecc87a39..127fae74 100755 --- a/stages/org.osbuild.ostree +++ b/stages/org.osbuild.ostree @@ -35,7 +35,19 @@ STAGE_OPTS = """ "type": "array", "items": { "description": "Description of one mount point", - "type": "string" + "type": "object", + "required": ["path"], + "properties": { + "path": { + "description": "The path of the mount point", + "type": "string" + }, + "mode": { + "description": "The mode of the mount point", + "type": "integer", + "default": 493 + } + } } }, "kernel_opts": { @@ -156,9 +168,10 @@ def main(tree, sources, options): with MountGuard() as mounter: for mount in mounts: - path = os.path.join(tree, mount) - print(f"mounting {path} onto itself") - os.makedirs(path, exist_ok=True) # FIXME: SELinux + path = mount["path"].lstrip("/") + path = os.path.join(tree, path) + os.makedirs(path, exist_ok=True) + os.chmod(path, mount.get("mode", 0o755)) mounter.mount(path, path) rootfs_id = make_fs_identifier(rootfs)