|
Packit Service |
a2ae7a |
(* MySQL module for Augeas *)
|
|
Packit Service |
a2ae7a |
(* Author: Tim Stoop <tim@kumina.nl> *)
|
|
Packit Service |
a2ae7a |
(* Heavily based on php.aug by Raphael Pinson *)
|
|
Packit Service |
a2ae7a |
(* <raphink@gmail.com> *)
|
|
Packit Service |
a2ae7a |
(* *)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module MySQL =
|
|
Packit Service |
a2ae7a |
autoload xfm
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* INI File settings
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
let comment = IniFile.comment IniFile.comment_re "#"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let sep = IniFile.sep IniFile.sep_re IniFile.sep_default
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let entry =
|
|
Packit Service |
a2ae7a |
let bare = Quote.do_dquote_opt_nil (store /[^#;" \t\r\n]+([ \t]+[^#;" \t\r\n]+)*/)
|
|
Packit Service |
a2ae7a |
in let quoted = Quote.do_dquote (store /[^"\r\n]*[#;]+[^"\r\n]*/)
|
|
Packit Service |
a2ae7a |
in [ Util.indent . key IniFile.entry_re . sep . Sep.opt_space . bare . (comment|IniFile.eol) ]
|
|
Packit Service |
a2ae7a |
| [ Util.indent . key IniFile.entry_re . sep . Sep.opt_space . quoted . (comment|IniFile.eol) ]
|
|
Packit Service |
a2ae7a |
| [ Util.indent . key IniFile.entry_re . store // . (comment|IniFile.eol) ]
|
|
Packit Service |
a2ae7a |
| comment
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* sections, led by a "[section]" header
|
|
Packit Service |
a2ae7a |
* We can't use titles as node names here since they could contain "/"
|
|
Packit Service |
a2ae7a |
* We remove #comment from possible keys
|
|
Packit Service |
a2ae7a |
* since it is used as label for comments
|
|
Packit Service |
a2ae7a |
* We also remove / as first character
|
|
Packit Service |
a2ae7a |
* because augeas doesn't like '/' keys (although it is legal in INI Files)
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
let title = IniFile.indented_title_label "target" IniFile.record_label_re
|
|
Packit Service |
a2ae7a |
let record = IniFile.record title entry
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let includedir = Build.key_value_line /!include(dir)?/ Sep.space (store Rx.fspath)
|
|
Packit Service |
a2ae7a |
. (comment|IniFile.empty)*
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let lns = (comment|IniFile.empty)* . (record|includedir)*
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let filter = (incl "/etc/mysql/my.cnf")
|
|
Packit Service |
a2ae7a |
. (incl "/etc/mysql/conf.d/*.cnf")
|
|
Packit Service |
a2ae7a |
. (incl "/etc/my.cnf")
|
|
Packit Service |
a2ae7a |
. (incl "/etc/my.cnf.d/*.cnf")
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let xfm = transform lns filter
|
|
Packit Service |
a2ae7a |
|