From d3917582873df723aa2a3ddbb6116950292e114c Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Tue, 29 Aug 2023 11:50:00 +0200 Subject: cooker: simplify tag and add caller metadata Group the metadata information: - simplify the json by removing the 'tag' and only using 'get' and 'set' keys - get uid and gid at runtime for the target ('caller'). This can be useful when the the UID and GID of the target are only known at runtime and they need to be used for setting the permissions of files - updated example demo/mknod.hjson Signed-off-by: Alice Frosi --- demo/mknod.hjson | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'demo') diff --git a/demo/mknod.hjson b/demo/mknod.hjson index 1936eb8..98715ec 100644 --- a/demo/mknod.hjson +++ b/demo/mknod.hjson @@ -2,32 +2,41 @@ { "match": [ { "mknodat": - { "path": { "tag": "path" }, - "mode": { "tag": "mode" }, - "type": { "tag": "type" }, + { "path": { "set": "path" }, + "mode": { "set": "mode" }, + "type": { "set": "type" }, "major": 1, - "minor": { "value": { "in": [ 3, 5, 7, 8, 9 ] }, "tag": "minor" } + "minor": { "value": { "in": [ 3, 5, 7, 8, 9 ] }, "set": "minor" } } }, { "mknod": - { "path": { "tag": "path" }, - "mode": { "tag": "mode" }, - "type": { "tag": "type" }, + { "path": { "set": "path" }, + "mode": { "set": "mode" }, + "type": { "set": "type" }, "major": 1, - "minor": { "value": { "in": [ 3, 5, 7, 8, 9 ] }, "tag": "minor" } + "minor": { "value": { "in": [ 3, 5, 7, 8, 9 ] }, "set": "minor" } } } ], - "call": + "call": [ { "mknod": - { "path": { "tag": { "get": "path" } }, - "mode": { "tag": { "get": "mode" } }, - "type": { "tag": { "get": "type" } }, + { "path": { "get": "path" }, + "mode": { "get": "mode" }, + "type": { "get": "type" }, "major": 1, - "minor": { "tag": { "get": "minor" } } + "minor": { "get": "minor" } }, - "context": { "mnt": "caller", "uid": "caller", "gid": "caller" } + "context": { "mnt": "caller" } }, + { + "lchown": { + "path": { "get": "path" }, + "uid" : { "caller": "uid" }, + "gid" : { "caller": "gid" } + }, + "context": { "mnt": "caller" } + } + ], "return": { "value": 0, "error": 0 } } ] -- cgit v1.2.3