For many applications and services you might have prepared a
configuration file which should be copied to the appropriate
location in the installed system, for example if you are
installing a web server and have a ready to go
server configuration file (httpd.conf).
Using this resource, you can embed the file into the control file by specifying the final path on the installed system. YaST will copy this file to the specified location.
This feature requires the autoyast2 package to be installed. If the package is missing, AutoYaST will silently ignore the files section. Since openSUSE 11.1 and SLES11, AutoYaST will install the package automatically if it is missing.
Since openSUSE 11.1 and SLES11, you can specify the file_location where the file should be retrieved from. For an HTTP server this would look like: <file_location>http://my.server.site/issue</file_location>.
Since openSUSE 11.2 (not SLES11), you can create directories by specifying a file_path that ends with a slash.
Example 4.34. Dumping files into the installed system
<files config:type="list">
<config_file>
<file_path>/etc/httpd/httpd.conf</file_path>
<file_contents>
<![CDATA[
some content
]]>
</file_contents>
</config_file>
</files>
<files config:type="list">
<config_file>
<file_path>/mydir/a/b/c/</file_path> <!-- create directory (since openSUSE 11.2) -->
</config_file>
</files>
A more advanced example is shown below. This configuration will create a file using the content supplied in file_contents and change the permissions and ownership of the file. After the file has been copied to the system, a script is executed, which can be used to manipulate the file and prepare it for the environment of the client.
Example 4.35. Dumping files into the installed system
<files config:type="list">
<config_file>
<file_path>/etc/someconf.conf</file_path>
<file_contents>
<![CDATA[
some content
]]>
</file_contents>
<file_owner>nashif.users</file_owner>
<file_permissions>444</file_permissions>
<file_script>
<interpreter>shell</interpreter>
<source>
<![CDATA[
#!/bin/sh
echo "Testing file scripts" >> /etc/someconf.conf
df
cd /mnt
ls
]]>
</source>
</file_script>
</config_file>
</files>