Loss-aware representation of a systemd unit file.
Unit files preserve ordering and duplicate directives. They are intentionally
not represented as maps because repeated directives and reset directives such
as ExecStart= are meaningful in systemd syntax.
Summary
Functions
Appends a directive to the last matching section, creating the section if needed.
Deletes matching directives from a section.
Returns all directive values matching a section and directive name.
Parses unit file text.
Parses unit file text, raising on failure.
Replaces all matching directives in a section with a single directive.
Builds a service unit file from common Unit, Service, and Install sections.
Renders a unit file.
Validates a unit file.
Types
@type entry() :: Systemd.UnitFile.Blank.t() | Systemd.UnitFile.Comment.t() | Systemd.UnitFile.Directive.t() | Systemd.UnitFile.Raw.t() | Systemd.UnitFile.Section.t()
@type t() :: %Systemd.UnitFile{entries: [entry()]}
Functions
Appends a directive to the last matching section, creating the section if needed.
Deletes matching directives from a section.
Returns all directive values matching a section and directive name.
Parses unit file text.
Parses unit file text, raising on failure.
Replaces all matching directives in a section with a single directive.
Builds a service unit file from common Unit, Service, and Install sections.
Renders a unit file.
@spec validate(t(), String.t() | atom() | nil) :: :ok | {:error, [Systemd.UnitFile.ValidationError.t()]}
Validates a unit file.