AutoYaST: splitting up config files
OK, AutoYaST has some nice features. But it's an evil beast. Handling the XML files is horrible, and documentation is not exactly elaborate. In my quest to eliminate duplication between the various installation profiles, I found out the following snippets of wisdom.
Files can be included by adding XInclude
as a namespace to the profile tag in the control file.
<xi:include href="http://server/path/to/some/file.xml" />
<xi:include href="http://server/path/to/some/otherfile.xml" />
- includes can't be nested, i.e. no includes within included files
- the full URL must be specified, i.e. no relative paths
- settings overwrite each other. If, for example, the <software> tag is specified in two different files, the set in the second file will overwrite the the set in the first file.
- include files are validated, so they must be valid XML. This is no text-replacement like the C preprocessor does.
- in the included files just the definition of the config namespace is enough. They don't need the <profile> tag. If <?xml version="1.0"?> is also present, Firefox can be used as a simple syntax checker though.
- <pre-scripts> don't seem to be run if they are in an included file!
Classes seem to be little more than includes, but they have the big advantage that setting from different files can be merged together.
This is how it works:
- the autoyast kernel parameter doesn't define a file, but a directory
- all relative URLs are relative from the path given in the autoyast kernel parameter
- somewhere in a file AutoYaST reads (e.g. via rules.xml or directly) one or more class sections within an <autoinstall> tag. This is how the classes are linked to the installation.
- the files specified within the <classes><class><configuration> tags are included
- the path of this files are classes/classname/file.xml, where classname is the name given in the <class_name> tag and file.xml is the filename from the <configuration> tag
- if you leave out <class_name> (e.g. by specifying <name> as suggested by some documentation) AutoYaST will try to fetch the files from classes/none/
- includes are possible within classes
- tags “should” be ordered alphabetically, because “it's better” …
- if a tag appears multiple times in different classes, they are merged! Well, somehow. It's all written in the documentation. I got it to work, but I can't say I had understand it. You have to specify <dont_merge> to enable the merge. Logisch.
To merge two <software>
tags via classes, the following snippet is needed within the <class>
below the class with the first occurence of <software>
(in the class that will be merged in).
- <dont_merge config> is also possible in rules
- classes can be included by rules.
Licensed under the Creative Commons Attribution-Share Alike 3.0 License.