1 (* MySQL module for Augeas *)
2 (* Author: Tim Stoop <tim@kumina.nl> *)
3 (* Heavily based on php.aug by Raphael Pinson *)
4 (* <raphink@gmail.com> *)
10 (************************************************************************
12 *************************************************************************)
13 let comment = IniFile.comment IniFile.comment_re "#"
15 let sep = IniFile.sep IniFile.sep_re IniFile.sep_default
18 let bare = Quote.do_dquote_opt_nil (store /[^#;" \t\r\n]+([ \t]+[^#;" \t\r\n]+)*/)
19 in let quoted = Quote.do_dquote (store /[^"\r\n]*[#;]+[^"\r\n]*/)
20 in [ Util.indent . key IniFile.entry_re . sep . Sep.opt_space . bare . (comment|IniFile.eol) ]
21 | [ Util.indent . key IniFile.entry_re . sep . Sep.opt_space . quoted . (comment|IniFile.eol) ]
22 | [ Util.indent . key IniFile.entry_re . store // . (comment|IniFile.eol) ]
25 (************************************************************************
26 * sections, led by a "[section]" header
27 * We can't use titles as node names here since they could contain "/"
28 * We remove #comment from possible keys
29 * since it is used as label for comments
30 * We also remove / as first character
31 * because augeas doesn't like '/' keys (although it is legal in INI Files)
32 *************************************************************************)
33 let title = IniFile.indented_title_label "target" IniFile.record_label_re
34 let record = IniFile.record title entry
36 let includedir = Build.key_value_line /!include(dir)?/ Sep.space (store Rx.fspath)
37 . (comment|IniFile.empty)*
39 let lns = (comment|IniFile.empty)* . (record|includedir)*
41 let filter = (incl "/etc/mysql/my.cnf")
42 . (incl "/etc/mysql/conf.d/*.cnf")
43 . (incl "/etc/my.cnf")
45 let xfm = transform lns filter