[augeas-devel] Parsing network-scripts/ifcfg-*
Alan Pevec
apevec at redhat.com
Tue Apr 22 10:34:07 UTC 2008
David Lutterkort wrote:
> On Tue, 2008-04-22 at 00:47 +0100, Daniel P. Berrange wrote:
>> Can augtool take args and turn them into variables, which can be subsituted
>> in. eg say you had a script
>>
>> $ cat > nicsonboot.aug <<EOF
>> set /files/etc/sysconfig/network-scripts/ifcfg-eth0/ONBOOT $onboot
>> set /files/etc/sysconfig/network-scripts/ifcfg-br0/ONBOOT $onboot
>> EOF
>
> No, it doesn't. You can achieve a similar effect with a simple shell
> script that does the above cat, substituting its args for $onboot (or
> use the Ruby/Python bindings for more complicated things).
>
>> $ augtool nicsonboot.aug --onboot=no
>
> One small misconception: .aug files are not for manipulating the tree,
> they contain descriptions of file <-> tree mappings. augtool reads those
> files, constructs a tree based on the descriptions, and lets the user
> manipulate them with set/rm etc. commands before writing the tree back
> into files according to the descriptions.
>
> I just realized that my initial example is missing a 'save' at the end.
>
> The language for describing file <-> tree mappings is much more full
> featured and has variables etc. but no way to make persistent changes to
> files.
What about extending augtool, so that shebang would work, e.g.
#!/usr/bin/augconf
set /files/etc/sysconfig/network-scripts/ifcfg-eth0/ONBOOT $1
set /files/etc/sysconfig/network-scripts/ifcfg-br0/ONBOOT $1
save
Since .aug is reserved for grammars, convention for such configure scripts could be .ag - only three other usages in unrelated domains found: http://filext.com/file-extension/AG
More information about the augeas-devel
mailing list