[augeas-devel] Parsing network-scripts/ifcfg-*

David Lutterkort dlutter at redhat.com
Tue Apr 22 18:02:54 UTC 2008


On Tue, 2008-04-22 at 12:34 +0200, Alan Pevec wrote:

> 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

That would work, too. I am open to either Dan's suggestion (named
variables from the command line) or this (positional variables)

The only hitch is that augtool needs an additional command line
argument, say -f, to tell it to read commands from a file, so that such
scripts would start with

        #! /usr/bin/augtool -f

or the current behavior of assuming the non-option arguments to augtool
are a command to execute needs to be changed.

What makes me hesitant about all this though is that, even with argument
substitution, there's very little you can do in practice from those
scripts, mostly execute fixed set, rm, save, or print commands. I fear
that once we have argument substitution, variable assignment,
conditionals, loops, and all the other things needed for a richer
language will be the logical next step. Which begs the question of why
not just use the ruby or python bindings, if writing something like

        state=yes
        augtool <<EOF
        set /files/etc/sysconfig/network-scripts/ifcfg-eth0/ONBOOT
        $state
        set /files/etc/sysconfig/network-scripts/ifcfg-br0/ONBOOT $state
        save
        EOF
        
in a shell script doesn't suffice.

Eitehr way, if somebody wants to whip up patches for that scripting
behavior, I'll merge them.

David




More information about the augeas-devel mailing list