Tmpfiles

Parses systemd tmpfiles.d files

Author: Julien Pivotto roidel.nosp@m.apluie@inui.nosp@m.ts.eu

Summary
TmpfilesParses systemd tmpfiles.d files
ReferenceThis lens tries to keep as close as possible to `man 5 tmpfiles.d` where possible.
LicenseThis file is licenced under the LGPL v2+, like the rest of Augeas.
Lens UsageTo be documented
Configuration filesThis lens applies to /etc/tmpfiles.d/*.conf /usr/lib/tmpfiles.d/*.conf and /run/tmpfiles.d/*.conf.
ExamplesThe Test_Tmpfiles file contains various examples and tests.
USEFUL PRIMITIVES
Comments and empty lines
sep_spcSpace
sep_opt_spcOptional space (for the beginning of the lines)
commentComments
emptyEmpty lines
Lense-specific primitives
typeOne letter.
mode“-”, or 3-4 bytes.
age“-”, or one of the formats seen in the manpage: 10d, 5seconds, 1y5days.
argumentThe last field.
fieldApplies to the other fields: path, gid and uid fields
recordA valid record, one line in the file.
THE TMPFILES LENSE
lnsThe tmpfiles lens.
filter

Reference

This lens tries to keep as close as possible to `man 5 tmpfiles.d` where possible.

License

This file is licenced under the LGPL v2+, like the rest of Augeas.

Lens Usage

To be documented

Configuration files

This lens applies to /etc/tmpfiles.d/*.conf /usr/lib/tmpfiles.d/*.conf and /run/tmpfiles.d/*.conf.  See filter.

Examples

The Test_Tmpfiles file contains various examples and tests.

USEFUL PRIMITIVES

Comments and empty lines

sep_spc

let sep_spc = Sep.space

Space

sep_opt_spc

let sep_opt_spc = Sep.opt_space

Optional space (for the beginning of the lines)

comment

let comment = Util.comment

Comments

empty

let empty = Util.empty

Empty lines

Lense-specific primitives

type

let type = /([fFwdDvqQpLcbCxXrRzZtThHaAm]|[AabcLp]\+)!?/

One letter.  Some of them can have a “+” and all can have a “!”.

Not all letters are valid.

mode

let mode = /(-|~?[0-7]{3,4})/

”-”, or 3-4 bytes.  Optionally starts with a “~”.

age

let age = /(-|(~?[0-9]+(s|m|min|h|d|w|ms|us|((second|minute|hour|day|week|millisecond|microsecond)s?))?)+)/

”-”, or one of the formats seen in the manpage: 10d, 5seconds, 1y5days. optionally starts with a “~’.

argument

let argument = /([^# \t\n][^#\n]*[^# \t\n]|[^# \t\n])/

The last field.  It can contain spaces.

field

let field = /[^# \t\n]+/

Applies to the other fields: path, gid and uid fields

record

let record = [ seq "record" . sep_opt_spc . [ label "type" . store type ] . sep_spc . [ label "path" . store field ] . ( sep_spc . [ label "mode" . store mode ] . ( sep_spc . [ label "uid" . store field ] . ( sep_spc . [ label "gid" . store field ] . ( sep_spc . [ label "age" . store age ] . ( sep_spc . [ label "argument" . store argument ] )? )? )? )? )? . Util.comment_or_eol ]

A valid record, one line in the file.  Only the two first fields are mandatory.

THE TMPFILES LENSE

lns

let lns = ( empty | comment | record ) *

The tmpfiles lens.  Each line can be a comment, a record or empty.

filter

Provides unit tests and examples for the Tmpfiles lens.
let sep_spc = Sep.space
Space
let sep_opt_spc = Sep.opt_space
Optional space (for the beginning of the lines)
let comment = Util.comment
Comments
let empty = Util.empty
Empty lines
let type = /([fFwdDvqQpLcbCxXrRzZtThHaAm]|[AabcLp]\+)!?/
One letter.
let mode = /(-|~?[0-7]{3,4})/
“-”, or 3-4 bytes.
let age = /(-|(~?[0-9]+(s|m|min|h|d|w|ms|us|((second|minute|hour|day|week|millisecond|microsecond)s?))?)+)/
“-”, or one of the formats seen in the manpage: 10d, 5seconds, 1y5days.
let argument = /([^# \t\n][^#\n]*[^# \t\n]|[^# \t\n])/
The last field.
let field = /[^# \t\n]+/
Applies to the other fields: path, gid and uid fields
let record = [ seq "record" . sep_opt_spc . [ label "type" . store type ] . sep_spc . [ label "path" . store field ] . ( sep_spc . [ label "mode" . store mode ] . ( sep_spc . [ label "uid" . store field ] . ( sep_spc . [ label "gid" . store field ] . ( sep_spc . [ label "age" . store age ] . ( sep_spc . [ label "argument" . store argument ] )? )? )? )? )? . Util.comment_or_eol ]
A valid record, one line in the file.
let lns = ( empty | comment | record ) *
The tmpfiles lens.
Close