stages/systemd.unit.create: update schema to support [Mount]

This commit is contained in:
Achilleas Koutsou 2024-04-22 16:23:04 +02:00
parent b77b071598
commit 835b49d052

View file

@ -1,13 +1,13 @@
{ {
"summary": "Create Systemd services unit file", "summary": "Create a Systemd unit file",
"description": [ "description": [
"This stage allows to create Systemd unit files in", "This stage allows to create Systemd unit files. The `filename` property",
"`/usr/lib/systemd/system/`. The `filename` property specifies the", "specifies the, '.service' or '.mount' file to be added. These names are",
"'.service' file to be added. These names are validated using the", "validated using the, same rules as specified by systemd.unit(5) and they",
"same rules as specified by systemd.unit(5) and they must contain the", "must contain the, '.service' or '.mount' suffix (other types of unit files",
"'.service' suffix (other types of unit files are not supported).", "are not supported). 'unit-type' determines if the unit file is created at",
"'unit-type' determines if the unit file is created at global or", "'global' (user) or 'system' paths,'unit-path' will determine the systemd",
"system level,'unit-path' will determine the systemd unit load path.", "unit load path.",
"", "",
"The Unit configuration can currently specify the following subset", "The Unit configuration can currently specify the following subset",
"of options:", "of options:",
@ -28,6 +28,11 @@
" - 'ExecStart' - [string]", " - 'ExecStart' - [string]",
" - 'Environment' - [object]", " - 'Environment' - [object]",
" - 'EnvironmentFile' - [string]", " - 'EnvironmentFile' - [string]",
" - 'Mount' section",
" - 'What' - string",
" - 'Where' - string",
" - 'Type' - string",
" - 'Options' - string",
" - 'Install' section", " - 'Install' section",
" - 'WantedBy' - [string]", " - 'WantedBy' - [string]",
" - 'RequiredBy' - [string]" " - 'RequiredBy' - [string]"
@ -41,7 +46,7 @@
"properties": { "properties": {
"filename": { "filename": {
"type": "string", "type": "string",
"pattern": "^[\\w:.\\\\-]+[@]{0,1}[\\w:.\\\\-]*\\.service$" "pattern": "^[\\w:.\\\\-]+[@]{0,1}[\\w:.\\\\-]*\\.(service|mount)$"
}, },
"unit-type": { "unit-type": {
"type": "string", "type": "string",
@ -64,10 +69,29 @@
"config": { "config": {
"additionalProperties": false, "additionalProperties": false,
"type": "object", "type": "object",
"required": [ "oneOf": [
"Unit", {
"Service", "required": [
"Install" "Unit",
"Service",
"Install"
],
"not": {
"required": [
"Mount"
]
}
},
{
"required": [
"Mount"
],
"not": {
"required": [
"Service"
]
}
}
], ],
"description": "Configuration for a '.service' unit.", "description": "Configuration for a '.service' unit.",
"properties": { "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": { "Install": {
"additionalProperties": false, "additionalProperties": false,
"type": "object", "type": "object",