Blame lenses/postfix_main.aug
|
Packit Service |
a2ae7a |
(* Postfix_Main module for Augeas
|
|
Packit Service |
a2ae7a |
Author: Free Ekanayaka <free@64studio.com>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Reference:
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module Postfix_Main =
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
autoload xfm
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* USEFUL PRIMITIVES
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let eol = Util.eol
|
|
Packit Service |
a2ae7a |
let indent = del /[ \t]*(\n[ \t]+)?/ " "
|
|
Packit Service |
a2ae7a |
let comment = Util.comment
|
|
Packit Service |
a2ae7a |
let empty = Util.empty
|
|
Packit Service |
a2ae7a |
let eq = del /[ \t]*=/ " ="
|
|
Packit Service |
a2ae7a |
let word = /[A-Za-z0-9_.-]+/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* The value of a parameter, after the '=' sign. Postfix allows that
|
|
Packit Service |
a2ae7a |
* lines are continued by starting continuation lines with spaces.
|
|
Packit Service |
a2ae7a |
* The definition needs to make sure we don't add indented comment lines
|
|
Packit Service |
a2ae7a |
* into values *)
|
|
Packit Service |
a2ae7a |
let value =
|
|
Packit Service |
a2ae7a |
let chr = /[^# \t\n]/ in
|
|
Packit Service |
a2ae7a |
let any = /.*/ in
|
|
Packit Service |
a2ae7a |
let line = (chr . any* . chr | chr) in
|
|
Packit Service |
a2ae7a |
let lines = line . (/[ \t]*\n[ \t]+/ . line)* in
|
|
Packit Service |
a2ae7a |
store lines
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* ENTRIES
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let entry = [ key word . eq . (indent . value)? . eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* LENS
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let lns = (comment|empty|entry) *
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let filter = incl "/etc/postfix/main.cf"
|
|
Packit Service |
a2ae7a |
. incl "/usr/local/etc/postfix/main.cf"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let xfm = transform lns filter
|