/usr/share/augeas/lenses/dist/dhclient.aug is in augeas-lenses 1.4.0-0ubuntu1.1.
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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | (* Intefraces module for Augeas
Author: Free Ekanayaka <free@64studio.com>
Reference: man dhclient.conf
The only difference with the reference syntax is that this lens assumes
that statements end with a new line, while the reference syntax allows
new statements to be started right after the trailing ";" of the
previous statement. This should not be a problem in real-life
configuration files as statements get usually splitted across several
lines, rather than merged in a single one.
*)
module Dhclient =
autoload xfm
(************************************************************************
* USEFUL PRIMITIVES
*************************************************************************)
let eol = Util.eol
let comment = Util.comment
let comment_or_eol = Util.comment_or_eol
let empty = Util.empty
(* Define separators *)
let sep_spc = del /[ \t\n]+/ " "
let sep_scl = del /[ \t]*;/ ";"
let sep_obr = del /[ \t\n]*\{\n]*/ " {\n"
let sep_cbr = del /[ \t\n]*\}/ " }"
let sep_com = del /[ \t\n]*,[ \t\n]*/ ","
let sep_slh = del "\/" "/"
let sep_col = del ":" ":"
let sep_eq = del /[ \t]*=[ \t]*/ "="
(* Define basic types *)
let word = /[A-Za-z0-9_.-]+(\[[0-9]+\])?/
(* Define fields *)
(* TODO: there could be a " " in the middle of a value ... *)
let sto_to_spc = store /[^\\#,;{}" \t\n]+|"[^\\#"\n]+"/
let sto_to_spc_noeval = store /[^=\\#,;{}" \t\n]|[^=\\#,;{}" \t\n][^\\#,;{}" \t\n]*|"[^\\#"\n]+"/
let sto_to_scl = store /[^ \t\n][^;\n]+[^ \t]|[^ \t;\n]+/
let rfc_code = [ key "code" . sep_spc . store word ]
. sep_eq
. [ label "value" . sto_to_scl ]
let eval = [ label "#eval" . Sep.equal . sep_spc . sto_to_scl ]
let sto_number = store /[0-9][0-9]*/
(************************************************************************
* SIMPLE STATEMENTS
*************************************************************************)
let stmt_simple_re = "timeout"
| "retry"
| "select-timeout"
| "reboot"
| "backoff-cutoff"
| "initial-interval"
| "do-forward-updates"
| "reject"
let stmt_simple = [ key stmt_simple_re
. sep_spc
. sto_to_spc
. sep_scl
. comment_or_eol ]
(************************************************************************
* ARRAY STATEMENTS
*************************************************************************)
(* TODO: the array could also be empty, like in the request statement *)
let stmt_array_re = "media"
| "request"
| "require"
let stmt_array = [ key stmt_array_re
. sep_spc
. counter "stmt_array"
. [ seq "stmt_array" . sto_to_spc ]
. [ sep_com . seq "stmt_array" . sto_to_spc ]*
. sep_scl . comment_or_eol ]
(************************************************************************
* HASH STATEMENTS
*************************************************************************)
let stmt_hash_re = "send"
| "option"
let stmt_hash = [ key stmt_hash_re
. sep_spc
. [ key word . sep_spc . (sto_to_spc_noeval|rfc_code|eval) ]
. sep_scl
. comment_or_eol ]
let stmt_opt_mod_re = "append"
| "prepend"
| "default"
| "supersede"
let stmt_opt_mod = [ key stmt_opt_mod_re . sep_spc . stmt_hash ]
(************************************************************************
* BLOCK STATEMENTS
*************************************************************************)
let stmt_block_re = "interface"
| "lease"
| "alias"
let stmt_block_opt_re = "interface"
| "script"
| "bootp"
| "fixed-address"
| "filename"
| "server-name"
| "medium"
| "vendor option space"
(* TODO: some options could take no argument like bootp *)
let stmt_block_opt = [ key stmt_block_opt_re
. sep_spc
. sto_to_spc
. sep_scl
. comment_or_eol ]
let stmt_block_date_re
= "renew"
| "rebind"
| "expire"
let stmt_block_date = [ key stmt_block_date_re
. [ sep_spc . label "weekday" . sto_number ]
. [ sep_spc . label "year" . sto_number ]
. [ sep_slh . label "month" . sto_number ]
. [ sep_slh . label "day" . sto_number ]
. [ sep_spc . label "hour" . sto_number ]
. [ sep_col . label "minute" . sto_number ]
. [ sep_col . label "second" . sto_number ]
. sep_scl
. comment_or_eol ]
let stmt_block_arg = sep_spc . sto_to_spc
let stmt_block_entry = sep_spc
. ( stmt_array
| stmt_hash
| stmt_opt_mod
| stmt_block_opt
| stmt_block_date )
let stmt_block = [ key stmt_block_re
. stmt_block_arg?
. sep_obr
. stmt_block_entry+
. sep_cbr
. comment_or_eol ]
(************************************************************************
* LENS & FILTER
*************************************************************************)
let statement = (stmt_simple|stmt_opt_mod|stmt_array|stmt_hash|stmt_block)
let lns = ( empty
| comment
| statement )*
let filter = incl "/etc/dhcp3/dhclient.conf"
. incl "/etc/dhcp/dhclient.conf"
. incl "/etc/dhclient.conf"
let xfm = transform lns filter
|