Parses systemd tmpfiles.d files
Author: Julien Pivotto roidel@inui ts.eu apluie
Tmpfiles | Parses systemd tmpfiles.d files |
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. |
Examples | The Test_Tmpfiles file contains various examples and tests. |
USEFUL PRIMITIVES | |
Comments and empty lines | |
sep_spc | Space |
sep_opt_spc | Optional space (for the beginning of the lines) |
comment | Comments |
empty | Empty lines |
Lense-specific primitives | |
type | One letter. |
mode | “-”, or 3-4 bytes. |
age | “-”, or one of the formats seen in the manpage: 10d, 5seconds, 1y5days. |
argument | The last field. |
field | Applies to the other fields: path, gid and uid fields |
record | A valid record, one line in the file. |
THE TMPFILES LENSE | |
lns | The tmpfiles lens. |
filter |
This lens applies to /etc/tmpfiles.d/*.conf /usr/lib/tmpfiles.d/*.conf and /run/tmpfiles.d/*.conf. See filter.
The Test_Tmpfiles file contains various examples and tests.
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.
Space
let sep_spc = Sep.space
Optional space (for the beginning of the lines)
let sep_opt_spc = Sep.opt_space
Comments
let comment = Util.comment
Empty lines
let empty = Util.empty
One letter.
let type = /([fFwdDvqQpLcbCxXrRzZtThHaAm]|[AabcLp]\+)!?/
“-”, or 3-4 bytes.
let mode = /(-|~?[0-7]{3,4})/
“-”, or one of the formats seen in the manpage: 10d, 5seconds, 1y5days.
let age = /(-|(~?[0-9]+(s|m|min|h|d|w|ms|us|((second|minute|hour|day|week|millisecond|microsecond)s?))?)+)/
The last field.
let argument = /([^# \t\n][^#\n]*[^# \t\n]|[^# \t\n])/
Applies to the other fields: path, gid and uid fields
let field = /[^# \t\n]+/
A valid record, one line in the file.
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 ]
The tmpfiles lens.
let lns = ( empty | comment | record ) *