help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

editfiles: adding/updating config file sections


From: Kai Großjohann
Subject: editfiles: adding/updating config file sections
Date: Sat, 19 Oct 2002 17:02:49 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

We have a lot of verses like the following in our cfengine 1.6
configuration:

    # Frob IDE parameters for speed.
    { /etc/init.d/hwtools
        AppendIfNoSuchLine "# begin i06"
        AppendIfNoSuchLine "# end i06"
        LocateLineMatching "# begin i06"
        DeleteToLineMatching "# end i06"
        DeleteLinesMatching "# end i06"
        AppendIfNoSuchLine "# begin i06"
        AppendIfNoSuchLine "# end i06"
        ResetSearch "1"
        LocateLineMatching "# begin i06"
        InsertFile "$(cfedir)/files/_etc_init.d_hwtools.template"
    }

The idea behind it is that there are section markers "# begin i06"
and "# end i06" in the file and cfengine updates the lines between
these section markers.  If the section markers are not in the file
yet, then they are added to the end of the file automatically.

The implementation is faulty (I think it always moves the section to
the end of the file, but if there are manually added lines after "#
end i06" then they should stay put), and it is quite clumsy.

Is there a better way to achieve this, perhaps new in cfengine 2?

kai
-- 
~/.signature is: umop ap!sdn    (Frank Nobis)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]