3 Parses autofs' auto.master files
5 Author: Dominic Cleal <dcleal@redhat.com>
11 This file is licenced under the LGPL v2+, like the rest of Augeas.
16 About: Configuration files
17 This lens applies to /etc/auto.master, auto_master and /etc/auto.master.d/*
21 The <Test_Automaster> file contains various examples and tests.
27 (************************************************************************
28 * Group: USEFUL PRIMITIVES
29 *************************************************************************)
35 let empty = Util.empty
38 let comment = Util.comment
41 let mount = /[^+ \t\n#]+/
44 yp, file, dir etc but not ldap *)
45 let type = Rx.word - /ldap/
52 let name = /[^: \t\n]+/
55 let host = /[^:# \n\t]+/
58 let dn = /[^:# \n\t]+/
60 (* An option label can't contain comma, comment, equals, or space *)
61 let optlabel = /[^,#= \n\t]+/
62 let spec = /[^,# \n\t][^ \n\t]*/
65 let optsep = del /[ \t,]+/ ","
67 (************************************************************************
69 *************************************************************************)
71 (* View: map_format *)
72 let map_format = [ label "format" . store format ]
75 let map_type = [ label "type" . store type ]
78 let map_name = [ label "map" . store name ]
81 Used for all except LDAP maps which are parsed further *)
82 let map_generic = ( map_type . ( Sep.comma . map_format )? . Sep.colon )?
85 (* View: map_ldap_name
86 Split up host:dc=foo into host/map nodes *)
87 let map_ldap_name = ( [ label "host" . store host ] . Sep.colon )?
88 . [ label "map" . store dn ]
91 let map_ldap = [ label "type" . store "ldap" ]
92 . ( Sep.comma . map_format )? . Sep.colon
95 (* View: comma_spc_sep_list
96 Parses options either for filesystems or autofs *)
97 let comma_spc_sep_list (l:string) =
98 let value = [ label "value" . Util.del_str "=" . store Rx.neg1 ] in
99 let lns = [ label l . store optlabel . value? ] in
100 Build.opt_list lns optsep
103 Mountpoint and whitespace, followed by the map info *)
104 let map_mount = [ seq "map" . store mount . Util.del_ws_tab
105 . ( map_generic | map_ldap )
106 . ( Util.del_ws_spc . comma_spc_sep_list "opt" )?
110 "+" to include more master entries and optional whitespace *)
111 let map_master = [ seq "map" . store "+" . Util.del_opt_ws ""
112 . ( map_generic | map_ldap )
113 . ( Util.del_ws_spc . comma_spc_sep_list "opt" )?
117 let lns = ( empty | comment | map_mount | map_master ) *
119 (* Variable: filter *)
120 let filter = incl "/etc/auto.master"
121 . incl "/etc/auto_master"
122 . incl "/etc/auto.master.d/*"
125 let xfm = transform lns filter