Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / sysctl.aug
1 (*
2 Module: Sysctl
3   Parses /etc/sysctl.conf and /etc/sysctl.d/*
4
5 Author: David Lutterkort <lutter@redhat.com>
6
7 About: Reference
8
9 About: License
10    This file is licenced under the LGPL v2+, like the rest of Augeas.
11
12 About: Lens Usage
13    To be documented
14
15 About: Configuration files
16    This lens applies to /etc/sysctl.conf and /etc/sysctl.d/*. See <filter>.
17
18 About: Examples
19    The <Test_Sysctl> file contains various examples and tests.
20 *)
21
22 module Sysctl =
23 autoload xfm
24
25 (* Variable: filter *)
26 let filter = incl "/boot/loader.conf"
27            . incl "/etc/sysctl.conf"
28            . incl "/etc/sysctl.d/*"
29            . excl "/etc/sysctl.d/README"
30            . excl "/etc/sysctl.d/README.sysctl"
31            . Util.stdexcl
32
33 (* View: comment *)
34 let comment = Util.comment_generic /[ \t]*[#;][ \t]*/ "# "
35
36 (* View: entry
37    basically a Simplevars.entry but key has to allow some special chars as '*' *)
38 let entry =
39      let some_value = Sep.space_equal . store Simplevars.to_comment_re
40   (* Rx.word extended by * and : *)
41   in let word = /[*:\/A-Za-z0-9_.-]+/
42   (* Avoid ambiguity in tree by making a subtree here *)
43   in let empty_value = [del /[ \t]*=/ "="] . store ""
44   in [ Util.indent . key word
45             . (some_value? | empty_value)
46             . (Util.eol | Util.comment_eol) ]
47
48 (* View: lns
49      The sysctl lens *)
50 let lns = (Util.empty | comment | entry)*
51
52 let xfm = transform lns filter