Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / solaris_system.aug
1 (*
2 Module: Solaris_System
3   Parses /etc/system on Solaris
4
5 Author: Dominic Cleal <dcleal@redhat.com>
6
7 About: Reference
8   This lens tries to keep as close as possible to `man 4 system` where possible.
9
10 About: Licence
11   This file is licensed under the LGPL v2+, like the rest of Augeas.
12
13 About: Lens Usage
14
15 About: Configuration files
16   This lens applies to /etc/system on Solaris. See <filter>.
17 *)
18
19 module Solaris_System =
20 autoload xfm
21
22 (************************************************************************
23  * Group:                 USEFUL PRIMITIVES
24  ************************************************************************)
25
26 (* View: comment *)
27 let comment = Util.comment_generic /[ \t]*\*[ \t]*/ "* "
28
29 (* View: empty
30     Map empty lines, including empty asterisk comments *)
31 let empty   = [ del /[ \t]*\*?[ \t]*\n/ "\n" ]
32
33 (* View: sep_colon
34     The separator for key/value entries *)
35 let sep_colon = del /:[ \t]*/ ": "
36
37 (* View: sep_moddir
38     The separator of directories in a moddir search path *)
39 let sep_moddir = del /[: ]+/ " "
40
41 (* View: modpath
42     Individual moddir search path entry *)
43 let modpath = [ seq "modpath" . store /[^ :\t\n]+/ ]
44
45 (* Variable: set_operator
46     Valid set operators: equals, bitwise AND and OR *)
47 let set_operators = /[=&|]/
48
49 (* View: set_value
50     Sets an integer value or char pointer *)
51 let set_value = [ label "value" . store Rx.no_spaces ]
52
53 (************************************************************************
54  * Group:                     COMMANDS
55  ************************************************************************)
56
57 (* View: cmd_kv
58     Function for simple key/value setting commands such as rootfs *)
59 let cmd_kv (cmd:string) (value:regexp) =
60     Build.key_value_line cmd sep_colon (store value)
61
62 (* View: cmd_moddir
63     The moddir command for specifying module search paths *)
64 let cmd_moddir =
65     Build.key_value_line "moddir" sep_colon
66         (Build.opt_list modpath sep_moddir)
67
68 (* View: set_var
69     Loads the variable name from a set command, no module *)
70 let set_var = [ label "variable" . store Rx.word ]
71
72 (* View: set_var
73     Loads the module and variable names from a set command *)
74 let set_varmod = [ label "module" . store Rx.word ]
75                  . Util.del_str ":" . set_var
76
77 (* View: set_sep_spc *)
78 let set_sep_spc = Util.del_opt_ws " "
79
80 (* View: cmd_set
81     The set command for individual kernel/module parameters *)
82 let cmd_set = [ key "set"
83               . Util.del_ws_spc
84               . ( set_var | set_varmod )
85               . set_sep_spc
86               . [ label "operator" . store set_operators ]
87               . set_sep_spc
88               . set_value
89               . Util.eol ]
90
91 (************************************************************************
92  * Group:                     LENS
93  ************************************************************************)
94
95 (* View: lns *)
96 let lns = ( empty
97           | comment
98           | cmd_moddir
99           | cmd_kv "rootdev" Rx.fspath
100           | cmd_kv "rootfs" Rx.word
101           | cmd_kv "exclude" Rx.fspath
102           | cmd_kv "include" Rx.fspath
103           | cmd_kv "forceload" Rx.fspath
104           | cmd_set )*
105
106 (* Variable: filter *)
107 let filter = (incl "/etc/system")
108
109 let xfm = transform lns filter