Skip to content

Commit

Permalink
scripts/augeas/nutnutconf.aug.in: handle "nut.conf" keywords introduc…
Browse files Browse the repository at this point in the history
…ed between NUT 2.6.5 and 2.8.2 [networkupstools#2294]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Apr 26, 2024
1 parent 309f909 commit b62856d
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion scripts/augeas/nutnutconf.aug.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Module: NutNutConf
Parses @CONFPATH@/nut.conf

Author: Frederic Bohe <[email protected]>
Jim Klimov <[email protected]>

About: License
This file is licensed under the GPL.
Expand Down Expand Up @@ -32,15 +33,48 @@ let eol = Util.eol
let comment = Util.comment
let empty = Util.empty

(* note different definitions than in other configs - this one is shell-syntax *)
let bool = /true|false|"true"|"false"|'true'|'false'/
let num = /[0-9]+|"[0-9]+"|'[0-9]+'/
let num_signed = /[+-]?[0-9]+|"[+-]?[0-9]+"|'[+-]?[0-9]+'/
let word = /[^"#; \t\n]+/

(* Variable: quoted_word *)
let word_space = /"[^"\n]+"/
let quoted_word = /"[^" \t\n]+"|'[^' \t\n]+'/

(* Variable: word_all *)
let word_all = word_space | word | quoted_word

let nut_possible_mode = "none"
| "standalone"
| "netserver"
| "netclient"
| "controlled"
| "manual"

let nut_mode = [ sep_spc . key "MODE" . def_sep . sep_spc . store nut_possible_mode . eol ]

let nut_lns = (nut_mode|comment|empty)*
let nut_bool_re = "ALLOW_NO_DEVICE"
| "ALLOW_NOT_ALL_LISTENERS"
| "POWEROFF_QUIET"

let nut_bool = [ sep_spc . key nut_bool_re . def_sep . sep_spc . store bool . eol ]

let nut_num_re = "POWEROFF_WAIT"

let nut_num = [ sep_spc . key nut_num_re . def_sep . sep_spc . store num . eol ]

let nut_num_signed_re = "NUT_DEBUG_LEVEL"

let nut_num_signed = [ sep_spc . key nut_num_signed_re . def_sep . sep_spc . store num_signed . eol ]

let nut_word_all_re = "UPSD_OPTIONS"
| "UPSMON_OPTIONS"

let nut_word_all = [ sep_spc . key nut_word_all_re . def_sep . sep_spc . store word_all . eol ]

let nut_lns = (nut_mode|nut_bool|nut_num|nut_num_signed|nut_word_all|comment|empty)*

let nut_filter = ( incl "@CONFPATH@/nut.conf" )
. Util.stdexcl
Expand Down

0 comments on commit b62856d

Please sign in to comment.