diff --git a/stages/org.osbuild.systemd.unit.create b/stages/org.osbuild.systemd.unit.create index 2c367f3f..2a027f3c 100755 --- a/stages/org.osbuild.systemd.unit.create +++ b/stages/org.osbuild.systemd.unit.create @@ -17,6 +17,8 @@ def validate(filename, cfg): raise ValueError(f"Error: {filename} unit requires Service section") if filename.endswith(".mount") and "Mount" not in cfg: raise ValueError(f"Error: {filename} unit requires Mount section") + if filename.endswith(".socket") and "Socket" not in cfg: + raise ValueError(f"Error: {filename} unit requires Socket section") def main(tree, options): diff --git a/stages/org.osbuild.systemd.unit.create.meta.json b/stages/org.osbuild.systemd.unit.create.meta.json index 2446a8c0..564c4f97 100644 --- a/stages/org.osbuild.systemd.unit.create.meta.json +++ b/stages/org.osbuild.systemd.unit.create.meta.json @@ -33,6 +33,19 @@ " - 'Where' - string", " - 'Type' - string", " - 'Options' - string", + " - 'Socket' section", + " - 'ListenStream' - string", + " - 'ListenDatagram' - string", + " - 'ListenSequentialPacket' - string", + " - 'ListenFifo' - string", + " - 'SocketUser' - string", + " - 'SocketGroup' - string", + " - 'SocketMode' - string", + " - 'DirectoryMode' - string", + " - 'Accept' - bool", + " - 'Service' - string", + " - 'RuntimeDirectory' - string", + " - 'RemoveOnStop' - bool", " - 'Install' section", " - 'WantedBy' - [string]", " - 'RequiredBy' - [string]" @@ -46,7 +59,7 @@ "properties": { "filename": { "type": "string", - "pattern": "^[\\w:.\\\\-]+[@]{0,1}[\\w:.\\\\-]*\\.(service|mount)$" + "pattern": "^[\\w:.\\\\-]+[@]{0,1}[\\w:.\\\\-]*\\.(service|mount|socket)$" }, "unit-type": { "type": "string", @@ -78,7 +91,19 @@ ], "not": { "required": [ - "Mount" + "Mount", + "Socket" + ] + } + }, + { + "required": [ + "Socket" + ], + "not": { + "required": [ + "Mount", + "Service" ] } }, @@ -88,7 +113,8 @@ ], "not": { "required": [ - "Service" + "Service", + "Socket" ] } } @@ -236,6 +262,61 @@ } } }, + "Socket": { + "additionalProperties": false, + "type": "object", + "description": "'Socket' configuration section of a unit file.", + "properties": { + "Service": { + "description": "", + "type": "string" + }, + "ListenStream": { + "description": "", + "type": "string" + }, + "ListenDatagram": { + "description": "", + "type": "string" + }, + "ListenSequentialPacket": { + "description": "", + "type": "string" + }, + "ListenFifo": { + "description": "", + "type": "string" + }, + "SocketUser": { + "description": "", + "type": "string" + }, + "SocketGroup": { + "description": "", + "type": "string" + }, + "SocketMode": { + "description": "", + "type": "string" + }, + "DirectoryMode": { + "description": "", + "type": "string" + }, + "Accept": { + "description": "", + "type": "boolean" + }, + "RuntimeDirectory": { + "description": "", + "type": "string" + }, + "RemoveOnStop": { + "description": "", + "type": "boolean" + } + } + }, "Install": { "additionalProperties": false, "type": "object",