3 Parses /etc/modprobe.conf and /etc/modprobe.d/*
5 Original Author: David Lutterkort <lutter@redhat.com>
7 Author: Raphael Pinson <raphink@gmail.com>
10 This lens tries to keep as close as possible to `man 5 modprobe.conf` where possible.
13 This file is licenced under the LGPL v2+, like the rest of Augeas.
18 About: Configuration files
19 This lens applies to /etc/modprobe.conf and /etc/modprobe.d/*. See <filter>.
25 (************************************************************************
26 * Group: USEFUL PRIMITIVES
27 *************************************************************************)
30 let comment = Util.comment
33 let empty = Util.empty
36 let sep_space = del /([ \t]|(\\\\\n))+/ " "
38 (* View: sto_no_spaces *)
39 let sto_no_spaces = store /[^# \t\n\\\\]+/
41 (* View: sto_no_colons *)
42 let sto_no_colons = store /[^:# \t\n\\\\]+/
44 (* View: sto_to_eol *)
45 let sto_to_eol = store /(([^# \t\n\\\\][^#\n\\\\]*[ \t]*\\\\[ \t]*\n[ \t]*)*([^# \t\n\\\\][^#\n\\\\]*[^# \t\n\\\\]|[^# \t\n\\\\])|[^# \t\n\\\\])/
49 let modulename = [ label "modulename" . sto_no_spaces ] in
50 Build.key_value_line_comment "alias" sep_space
51 (sto_no_spaces . sep_space . modulename)
54 (************************************************************************
56 *************************************************************************)
60 let opt_value = /[^#" \t\n\\\\]+|"[^#"\n\\\\]*"/ in
61 let option = [ key Rx.word . (del /[ \t]*=[ \t]*/ "=" . store opt_value)? ] in
62 [ key "options" . sep_space . sto_no_spaces
63 . (sep_space . option)* . Util.comment_or_eol ]
65 (* View: install_remove *)
66 let kv_line_command (kw:regexp) =
67 let command = [ label "command" . sto_to_eol ] in
68 [ key kw . sep_space . sto_no_spaces
69 . sep_space . command . Util.comment_or_eol ]
72 let blacklist = Build.key_value_line_comment "blacklist" sep_space
77 let config = Build.key_value_line_comment "config" sep_space
78 (store /binary_indexes|yes|no/)
83 let premod = [ label "pre" . sep_space . sto_no_colons ] in
84 let pre = sep_space . Util.del_str "pre:" . premod+ in
85 let postmod = [ label "post" . sep_space . sto_no_colons ] in
86 let post = sep_space . Util.del_str "post:" . postmod+ in
87 [ key "softdep" . sep_space . sto_no_colons . pre? . post?
88 . Util.comment_or_eol ]
93 | kv_line_command /install|remove/
98 (************************************************************************
99 * Group: LENS AND FILTER
100 *************************************************************************)
103 let lns = (comment|empty|entry)*
106 let filter = (incl "/etc/modprobe.conf") .
107 (incl "/etc/modprobe.d/*").
108 (incl "/etc/modprobe.conf.local").
111 let xfm = transform lns filter