Automounter

Parses automounter file based maps

Author: Dominic Cleal dcl.nosp@m.eal@redha.nosp@m.t.com

Summary
AutomounterParses automounter file based maps
ReferenceSee autofs(5)
LicenseThis file is licenced under the LGPL v2+, like the rest of Augeas.
Lens UsageTo be documented
Configuration filesThis lens applies to /etc/auto.*, auto_*, excluding known scripts.
ExamplesThe <Test_Automounter> file contains various examples and tests.
USEFUL PRIMITIVES
eol
empty
comment
path
hostname
weight
map_name
entry_multimount_sepSeparator for multimount entries, permits line spanning with “\”
ENTRIES
entry_keyKey for a map entry
entry_pathPath component of an entry location
entry_hostHost component with optional weight of an entry location
comma_sep_listParses options for filesystems
entry_options
entry_locationA single location with one or more hosts, and one path
entry_locationsMultiple locations (each with one or more hosts), separated by spaces
entry_multimountParses one of many mountpoints given for a multimount line
entry_multimountsParses multiple mountpoints given on an entry line
entryA single map entry from start to finish, including multi-mounts
includeAn include line starting with a “+” and a map name
lns
filterExclude scripts/executable maps from here

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

let eol = Util.eol

empty

let empty = Util.empty

comment

let comment = Util.comment

path

let path = /[^-+#: \t\n][^#: \t\n]*/

hostname

let hostname = /[^-:#\(\), \n\t][^:#\(\), \n\t]*/

weight

let weight = Rx.integer

map_name

let map_name = /[^: \t\n]+/

entry_multimount_sep

let entry_multimount_sep = del /[ \t]+(\\\\[ \t]*\n[ \t]+)?/ " "

Separator for multimount entries, permits line spanning with “\”

ENTRIES

entry_key

Key for a map entry

entry_path

let entry_path = [ label "path" . store path ]

Path component of an entry location

entry_host

let entry_host = [ label "host" . store hostname . ( Util.del_str "(" . [ label "weight" . store weight ] . Util.del_str ")" )? ]

Host component with optional weight of an entry location

comma_sep_list

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

Parses options for filesystems

entry_options

let entry_options = Util.del_str "-" . comma_sep_list "opt" . Util.del_ws_tab

entry_location

let entry_location = ( entry_host . ( Sep.comma . entry_host )* )? . Sep.colon . entry_path

A single location with one or more hosts, and one path

entry_locations

let entry_locations = [ label "location" . counter "location" . [ seq "location" . entry_location ] . ( [ Util.del_ws_spc . seq "location" . entry_location ] )* ]

Multiple locations (each with one or more hosts), separated by spaces

entry_multimount

let entry_multimount = entry_mkey . Util.del_ws_tab . entry_options? . entry_locations

Parses one of many mountpoints given for a multimount line

entry_multimounts

let entry_multimounts = [ label "mount" . counter "mount" . [ seq "mount" . entry_multimount ] . ( [ entry_multimount_sep . seq "mount" . entry_multimount ] )* ]

Parses multiple mountpoints given on an entry line

entry

let entry = [ seq "entry" . entry_mkey . Util.del_ws_tab . entry_options? . ( entry_locations | entry_multimounts ) . Util.eol ]

A single map entry from start to finish, including multi-mounts

include

let include = [ seq "entry" . store "+" . Util.del_opt_ws "" . [ label "map" . store map_name ] . Util.eol ]

An include line starting with a “+” and a map name

lns

let lns = ( empty | comment | entry | include ) *

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]+/
let entry_multimount_sep = del /[ \t]+(\\\\[ \t]*\n[ \t]+)?/ " "
Separator for multimount entries, permits line spanning with “\”
let entry_path = [ label "path" . store path ]
Path component of an entry location
let entry_host = [ label "host" . store hostname . ( Util.del_str "(" . [ label "weight" . store weight ] . Util.del_str ")" )? ]
Host component with optional weight of an entry location
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
Parses options for filesystems
let entry_options = Util.del_str "-" . comma_sep_list "opt" . Util.del_ws_tab
let entry_location = ( entry_host . ( Sep.comma . entry_host )* )? . Sep.colon . entry_path
A single location with one or more hosts, and one path
let entry_locations = [ label "location" . counter "location" . [ seq "location" . entry_location ] . ( [ Util.del_ws_spc . seq "location" . entry_location ] )* ]
Multiple locations (each with one or more hosts), separated by spaces
let entry_multimount = entry_mkey . Util.del_ws_tab . entry_options? . entry_locations
Parses one of many mountpoints given for a multimount line
let entry_multimounts = [ label "mount" . counter "mount" . [ seq "mount" . entry_multimount ] . ( [ entry_multimount_sep . seq "mount" . entry_multimount ] )* ]
Parses multiple mountpoints given on an entry line
let entry = [ seq "entry" . entry_mkey . Util.del_ws_tab . entry_options? . ( entry_locations | entry_multimounts ) . Util.eol ]
A single map entry from start to finish, including multi-mounts
let include = [ seq "entry" . store "+" . Util.del_opt_ws "" . [ label "map" . store map_name ] . Util.eol ]
An include line starting with a “+” and a map name
let lns = ( empty | comment | entry | include ) *
Close