/usr/share/augeas/lenses/dist/exports.aug is in augeas-lenses 1.2.0-0ubuntu1.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | (* Lens for Linux syntax of NFS exports(5) *)
(*
Module: Exports
Parses /etc/exports
Author: David Lutterkort <lutter@redhat.com>
About: Description
/etc/exports contains lines associating a directory with one or
more hosts, and NFS options for each host.
About: Usage Example
(start code)
$ augtool
augtool> ls /files/etc/exports/
comment[1] = /etc/exports: the access control list for filesystems which may be exported
comment[2] = to NFS clients. See exports(5).
comment[3] = sample /etc/exports file
dir[1]/ = /
dir[2]/ = /projects
dir[3]/ = /usr
dir[4]/ = /home/joe
augtool> ls /files/etc/exports/dir[1]
client[1]/ = master
client[2]/ = trusty
(end code)
The corresponding line in the file is:
(start code)
/ master(rw) trusty(rw,no_root_squash)
(end code)
Digging further:
(start code)
augtool> ls /files/etc/exports/dir[1]/client[1]
option = rw
To add a new entry, you'd do something like this:
(end code)
(start code)
augtool> set /files/etc/exports/dir[10000] /foo
augtool> set /files/etc/exports/dir[last()]/client[1] weeble
augtool> set /files/etc/exports/dir[last()]/client[1]/option[1] ro
augtool> set /files/etc/exports/dir[last()]/client[1]/option[2] all_squash
augtool> save
Saved 1 file(s)
(end code)
Which creates the line:
(start code)
/foo weeble(ro,all_squash)
(end code)
About: Limitations
This lens cannot handle options without a host, as with the last
example line in "man 5 exports":
/pub (ro,insecure,all_squash)
In this case, though, you can just do:
/pub *(ro,insecure,all_squash)
It also can't handle whitespace before the directory name.
*)
module Exports =
autoload xfm
let client_re = /[a-zA-Z0-9.@*?\/:-]+/
let eol = Util.eol
let lbracket = Util.del_str "("
let rbracket = Util.del_str ")"
let sep_com = Sep.comma
let sep_spc = Sep.space
let option = [ label "option" . store /[^,)]*/ ]
let client = [ label "client" . store client_re .
( Build.brackets lbracket rbracket
( Build.opt_list option sep_com ) )? ]
let entry = [ label "dir" . store /\/[^ \t]*/
. sep_spc . Build.opt_list client sep_spc . eol ]
let lns = (Hosts.empty | Hosts.comment | entry)*
let xfm = transform lns (incl "/etc/exports")
|