1 (* Lens for Linux syntax of NFS exports(5) *)
7 Author: David Lutterkort <lutter@redhat.com>
10 /etc/exports contains lines associating a directory with one or
11 more hosts, and NFS options for each host.
18 augtool> ls /files/etc/exports/
19 comment[1] = /etc/exports: the access control list for filesystems which may be exported
20 comment[2] = to NFS clients. See exports(5).
21 comment[3] = sample /etc/exports file
28 augtool> ls /files/etc/exports/dir[1]
33 The corresponding line in the file is:
36 / master(rw) trusty(rw,no_root_squash)
42 augtool> ls /files/etc/exports/dir[1]/client[1]
45 To add a new entry, you'd do something like this:
49 augtool> set /files/etc/exports/dir[10000] /foo
50 augtool> set /files/etc/exports/dir[last()]/client[1] weeble
51 augtool> set /files/etc/exports/dir[last()]/client[1]/option[1] ro
52 augtool> set /files/etc/exports/dir[last()]/client[1]/option[2] all_squash
57 Which creates the line:
60 /foo weeble(ro,all_squash)
64 This lens cannot handle options without a host, as with the last
65 example line in "man 5 exports":
67 /pub (ro,insecure,all_squash)
69 In this case, though, you can just do:
71 /pub *(ro,insecure,all_squash)
73 It also can't handle whitespace before the directory name.
79 let client_re = /[][a-zA-Z0-9.@*?\/:-]+/
82 let lbracket = Util.del_str "("
83 let rbracket = Util.del_str ")"
84 let sep_com = Sep.comma
85 let sep_spc = Sep.space
87 let option = [ label "option" . store /[^,)]*/ ]
89 let client = [ label "client" . store client_re .
90 ( Build.brackets lbracket rbracket
91 ( Build.opt_list option sep_com ) )? ]
93 let entry = [ label "dir" . store /[^ \t\n#]*/
94 . sep_spc . Build.opt_list client sep_spc . eol ]
96 let lns = (Util.empty | Util.comment | entry)*
98 let xfm = transform lns (incl "/etc/exports")