Parses automounter file based maps
Author: Dominic Cleal dcleal@redhat.com
| Automounter | Parses automounter file based maps |
| Reference | See autofs(5) |
| License | This file is licenced under the LGPL v2+, like the rest of Augeas. |
| Lens Usage | To be documented |
| Configuration files | This lens applies to /etc/auto.*, auto_*, excluding known scripts. |
| Examples | The <Test_Automounter> file contains various examples and tests. |
| USEFUL PRIMITIVES | |
| eol | |
| empty | |
| comment | |
| path | |
| hostname | |
| weight | |
| map_name | |
| entry_multimount_sep | Separator for multimount entries, permits line spanning with “\” |
| ENTRIES | |
| entry_key | Key for a map entry |
| entry_path | Path component of an entry location |
| entry_host | Host component with optional weight of an entry location |
| comma_sep_list | Parses options for filesystems |
| entry_options | |
| entry_location | A single location with one or more hosts, and one path |
| entry_locations | Multiple locations (each with one or more hosts), separated by spaces |
| entry_multimount | Parses one of many mountpoints given for a multimount line |
| entry_multimounts | Parses multiple mountpoints given on an entry line |
| entry | A single map entry from start to finish, including multi-mounts |
| include | An include line starting with a “+” and a map name |
| lns | |
| filter | Exclude scripts/executable maps from here |
let eol = Util.eol
let empty = Util.empty
let comment = Util.comment
let path = /[^-+#: \t\n][^#: \t\n]*/
let hostname = /[^-:#\(\), \n\t][^:#\(\), \n\t]*/
let weight = Rx.integer
let map_name = /[^: \t\n]+/
Separator for multimount entries, permits line spanning with “\”
let entry_multimount_sep = del /[ \t]+(\\\\[ \t]*\n[ \t]+)?/ " "
Path component of an entry location
let entry_path = [ label "path" . store path ]
Host component with optional weight of an entry location
let entry_host = [ label "host" . store hostname . ( Util.del_str "(" . [ label "weight" . store weight ] . Util.del_str ")" )? ]
Parses options for filesystems
let comma_sep_list (l:string) = let value = [ label "value" . Util.del_str "=" . store Rx.neg1 ] in let lns = [ label l . store optlabel . value? ] in Build.opt_list lns Sep.comma
let entry_options = Util.del_str "-" . comma_sep_list "opt" . Util.del_ws_tab
A single location with one or more hosts, and one path
let entry_location = ( entry_host . ( Sep.comma . entry_host )* )? . Sep.colon . entry_path
Multiple locations (each with one or more hosts), separated by spaces
let entry_locations = [ label "location" . counter "location" . [ seq "location" . entry_location ] . ( [ Util.del_ws_spc . seq "location" . entry_location ] )* ]
Parses one of many mountpoints given for a multimount line
let entry_multimount = entry_mkey . Util.del_ws_tab . entry_options? . entry_locations
Parses multiple mountpoints given on an entry line
let entry_multimounts = [ label "mount" . counter "mount" . [ seq "mount" . entry_multimount ] . ( [ entry_multimount_sep . seq "mount" . entry_multimount ] )* ]
A single map entry from start to finish, including multi-mounts
let entry = [ seq "entry" . entry_mkey . Util.del_ws_tab . entry_options? . ( entry_locations | entry_multimounts ) . Util.eol ]
An include line starting with a “+” and a map name
let include = [ seq "entry" . store "+" . Util.del_opt_ws "" . [ label "map" . store map_name ] . Util.eol ]
let lns = ( empty | comment | entry | include ) *