From 835b49d052f5d035f2602fc95644f767108bc466 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 22 Apr 2024 16:23:04 +0200 Subject: [PATCH] stages/systemd.unit.create: update schema to support [Mount] --- .../org.osbuild.systemd.unit.create.meta.json | 76 +++++++++++++++---- 1 file changed, 63 insertions(+), 13 deletions(-) diff --git a/stages/org.osbuild.systemd.unit.create.meta.json b/stages/org.osbuild.systemd.unit.create.meta.json index 05431429..2446a8c0 100644 --- a/stages/org.osbuild.systemd.unit.create.meta.json +++ b/stages/org.osbuild.systemd.unit.create.meta.json @@ -1,13 +1,13 @@ { - "summary": "Create Systemd services unit file", + "summary": "Create a Systemd unit file", "description": [ - "This stage allows to create Systemd unit files in", - "`/usr/lib/systemd/system/`. The `filename` property specifies the", - "'.service' file to be added. These names are validated using the", - "same rules as specified by systemd.unit(5) and they must contain the", - "'.service' suffix (other types of unit files are not supported).", - "'unit-type' determines if the unit file is created at global or", - "system level,'unit-path' will determine the systemd unit load path.", + "This stage allows to create Systemd unit files. The `filename` property", + "specifies the, '.service' or '.mount' file to be added. These names are", + "validated using the, same rules as specified by systemd.unit(5) and they", + "must contain the, '.service' or '.mount' suffix (other types of unit files", + "are not supported). 'unit-type' determines if the unit file is created at", + "'global' (user) or 'system' paths,'unit-path' will determine the systemd", + "unit load path.", "", "The Unit configuration can currently specify the following subset", "of options:", @@ -28,6 +28,11 @@ " - 'ExecStart' - [string]", " - 'Environment' - [object]", " - 'EnvironmentFile' - [string]", + " - 'Mount' section", + " - 'What' - string", + " - 'Where' - string", + " - 'Type' - string", + " - 'Options' - string", " - 'Install' section", " - 'WantedBy' - [string]", " - 'RequiredBy' - [string]" @@ -41,7 +46,7 @@ "properties": { "filename": { "type": "string", - "pattern": "^[\\w:.\\\\-]+[@]{0,1}[\\w:.\\\\-]*\\.service$" + "pattern": "^[\\w:.\\\\-]+[@]{0,1}[\\w:.\\\\-]*\\.(service|mount)$" }, "unit-type": { "type": "string", @@ -64,10 +69,29 @@ "config": { "additionalProperties": false, "type": "object", - "required": [ - "Unit", - "Service", - "Install" + "oneOf": [ + { + "required": [ + "Unit", + "Service", + "Install" + ], + "not": { + "required": [ + "Mount" + ] + } + }, + { + "required": [ + "Mount" + ], + "not": { + "required": [ + "Service" + ] + } + } ], "description": "Configuration for a '.service' unit.", "properties": { @@ -186,6 +210,32 @@ } } }, + "Mount": { + "additionalProperties": false, + "type": "object", + "description": "'Mount' configuration section of a unit file.", + "required": [ + "What" + ], + "properties": { + "What": { + "description": "Absolute path to device node", + "type": "string" + }, + "Where": { + "description": "Absolute path for a file or directory for the mountpoint", + "type": "string" + }, + "Type": { + "descriptions": "File system type", + "type": "string" + }, + "Options": { + "descriptions": "Mount options to use when mounting", + "type": "string" + } + } + }, "Install": { "additionalProperties": false, "type": "object",