David Lutterkort
Tue, 01 Dec 2009 05:10:47 -0800
Hi Jon, On Mon, 2009-11-30 at 22:20 +0100, Jon Nordby wrote: > I'm interesting in writing an Arch Linux backend for netcf. I'd need > augeas support for the relevant configurations, but what else? What is > the basic principle, what functions should be implemented etc.? How do > I approach this?
An Arch Linux backend would be excellent. The basic idea is that you'd write code that replaces drv_initscripts.c and add some sort of switch to the autoconf setup that lets you choose the backend at build time. We've tried to factor common utility functions out of drv_initscripts.c into dutil.c and dutil_linux.c - if you find that some of hte drv_initscripts.c code is useful to you, you should just move it from that file into one of the util files. As for how you implement the backend, that's entirely up to you - strictly speaking, there's no need to use augeas or XSLT for that, though I found that that simplified the code for the Fedora/RHEL backend significantly. For modifying configs, the way drv_initscripts works is that it transforms back and forth between two trees using XSLT transforms. One tree is the DOM of the interface XML description (schema is defined in data/xml/interface.rng), the other is the Augeas tree containing the config files of interest to network config. The Augeas tree is converted into an XML DOM in a very simple, straightforward manner, so that an XSL transform can be applied to it. The data/xml/intscripts-get.xml takes the interface XML and turns it into Augeas XML, data/xml/initscripts-put.xml does the reverse transform. You can find examples of the two XML representations in tests/interface/ and tests/initscripts/ - if you go a similar route for the Arch Linux backend, you should add a directory tests/archlinux/ or similar and add files that correspond to the ones in tests/interface/ (and have some code that tests that one is successfully transformed into the other, see tests/test-initscripts.c) David _______________________________________________ netcf-devel mailing list netcf-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/netcf-devel