[augeas-devel] Syslinux config file lens
David Lutterkort
lutter at redhat.com
Mon Aug 17 22:48:33 UTC 2009
On Fri, 2009-08-14 at 13:01 +1000, Matthew Palmer wrote:
> On Thu, Aug 13, 2009 at 06:49:49PM -0700, David Lutterkort wrote:
> > One more question: how about parsing the arguments of an append into
> > nodes where the label is the name of the argument and the value is the
> > arg value; i.e. parse a line like
>
> Line 52. I'm happy to change that if you're happy to change the language.
> <grin>
Aah .. I see. Yeah, alowing '/' in labels is a non-starter. How about
parsing the key/value pair into two nodes, like
module T =
let s = "label lenny64
kernel vmlinuz-lenny64
append vga=normal initrd=initrd.img-lenny64 preseed/url=http://localhost/preseed.cfg --
"
test Syslinux.lns get s =
{ "label" = "lenny64"
{ "kernel" = "vmlinuz-lenny64" }
{ "append"
{ { "arg" = "vga" } { "value" = "normal" } }
{ { "arg" = "initrd" } { "value" = "initrd.img-lenny64" } }
{ { "arg" = "preseed/url" } { "value" = "http://localhost/preseed.cfg" } }
{ { "arg" = "--" } } } }
It's a little friendlier to people who want to find where 'vga' is set.
I did that with the following in syslinux.aug:
(***************************
* APPEND OPTION HANDLING
***************************)
let append_opt =
[ wsp . [ label "arg" . store /[^= \t\n]+/] .
[ Util.delstr "=" . label "value" . store /[^= \t\n]+/]? ]
let global_append = [ del /[Aa][Pp][Pp][Ee][Nn][Dd]/ "append"
. label "append"
. append_opt+
. eol
]
David
More information about the augeas-devel
mailing list