For many applications and services you might have prepared a
configuration file which should be copied in a complete form to some
location in the installed system. This is 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. YaST2 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 on it's own if it's missing.
Since openSUSE 11.1 and SLES11 you can specify a file_location where the file should be retrieved from, like an HTTP server for example. That would look like this <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 will 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>