Author: Raphael Pinson firstname.lastname@example.org@email@example.com
|Reference||This lens tries to keep as close as possible to ‘man services’ where possible.|
|License||This file is licensed under the LGPL v2+, like the rest of Augeas.|
|Lens Usage||Sample usage of this lens in augtool|
|Configuration files||This lens applies to /etc/services.|
|record||A standard /etc/services record TODO: make sure a space is added before a comment on new nodes|
|lns||The services lens is either <empty>, comment or record|
Sample usage of this lens in augtool
match "/files/etc/services/service-name[port = '22'][protocol = 'tcp']"
rm "/files/etc/services/service-name[. = 'domain'][protocol = 'tcp']"
ins service-name after /files/etc/services/service-name[last()] set /files/etc/services/service-name[last()] "myservice" set "/files/etc/services/service-name[. = 'myservice']/port" "55234" set "/files/etc/services/service-name[. = 'myservice']/protocol" "tcp"
This lens applies to /etc/services. See filter.
let eol = del /[ \t]*(#)?[ \t]*\n/ "\n"
let port = [ label "port" . store num_re ]
let port_range = [ label "start" . store num_re ] . Util.del_str "-" . [ label "end" . store num_re ]
let protocol = [ label "protocol" . store protocol_re ]
let alias = [ label "alias" . store word_re ]
A standard /etc/services record TODO: make sure a space is added before a comment on new nodes
let record = [ label "service-name" . store word_re . sep_spc . (port | port_range) . del "/" "/" . protocol . ( sep_spc . alias )* . comment_or_eol ]
The services lens is either empty, comment or record
let lns = ( empty | comment | record )*
Only supports “#” as commentary
let comment = IniFile.comment "#" "#"