By adding scripts to the auto-installation process you can customize the installation for your needs and take control in different stages of the installation.
In the auto-installation process, five types of scripts can be executed and they will be described here in order of "appearance" during the installation.
![]() | Note |
---|---|
All scripts have to be in the <scritps> section. |
Executed before YaST2 does any real change to the system (Before partitioning and package installation but after the hardware detection)
You can use the pre-script to modify your profile and let autoyast read it again. If you want to do that, you can find your profile in "/tmp/profile/autoinst.xml". Do what you want to do with that file and store the modified version in "/tmp/profile/modified.xml". Autoyast will read that modified script then again after the pre-script is done.
With SUSE Linux 10.0 and all following versions it's possible to change the partitioning with fdisk in your pre-script. With pre 10.0 versions of SUSE Linux (like SLES9), that was not possible.
![]() | Pre-Install Scripts with confirmation |
---|---|
Pre-scripts are executed at an early stage of the installation. This means if you have requested to confirm the installation, the pre-scripts will be executed before the confirmation screen shows up. (profile/install/general/mode/confirm) |
The following elements must be between the <scripts><pre-scripts config:type="list"><script> ... </script></pre-scripts>...</scripts> tags
Table 4.11. pre script XML representation
Element | Description | Comment |
---|---|---|
location | you can define a location from where the script gets fetched.
Locations can be the same like for the profile (http,ftp,nfs,...).
<location>http://10.10.0.1/myPreScript.sh</location> | either <location> or <source> must be defined |
source | the script itself. The source code of the script if you want so. Encapsulated in a CDATA tag. If you don't want
to put the whole shell script into the XML profile, look at the location parameter.
<source> <![CDATA[ echo "Testing the pre script" > /tmp/pre-script_out.txt ]]> </source> | Either <location> or <source> must be defined |
interpreter | the interpreter that must be used for the script. Supported options are shell and perl.
<interpreter>perl</interpreter> | optional (default is shell) |
filename | the filename of the script. It will be stored in a temporary directory under /tmp/...
<filename>myPreScript5.sh</filename> | optional. The default is the type of the script (pre-scripts) in this case |
feedback | if this boolean is true, stdout and stderr of the script will be shown in a popup that the
user has to confirm via ok-button. If stdout and stderr are empty, no popup is shown and so
no confirmation is needed.
<feedback config:type="boolean">true</feedback> | optional. The default is false. This option was invented with SL 10.1 / SLES10 |
feedback_type | this can be "message", "warning", "error" and you can control the timeout of those popups with the <report> section.
<feedback_type>warning</feedback_type> | optional. If missing, an always blocking popup is used. This option was invited with openSUSE 11.2 (not SLES11) |
debug | if this is true, every single line of a shell script is logged. Perl scripts are run with warnings
turned on.
<debug config:type="boolean">true</debug> | optional. The default is true. This option was invented with SL 10.1 / SLES10 |
notification | This text will be shown in a popup for the time the script is running in the background
<notification>Please wait while script is running ...</notification> | optional. If not configured, no notification popup will be shown. This option was invented with openSUSE 11.3 (not SLES11) |
rerun | a script is only run once. So even if you use ayast_setup to run a XML file multiple times, the script is only run once. You can change that with this boolean.
<rerun config:type="boolean">true</rerun> | optional. The default is false which makes scripts only run one time |
![]() | Note |
---|---|
Available starting from openSUSE 11.2 only (not SLES11). |
Executed after YaST2 did the partitioning and wrote the fstab. The empty system is mounted to /mnt already. This type of script is available since openSUSE 11.2 (not SLES11).
The following elements must be between the <scripts><postpartitioning-scripts config:type="list"><script> ... </script></postpartitioning-scripts>...</scripts> tags
Table 4.12. postpartitioning script XML representation
Element | Description | Comment |
---|---|---|
location | you can define a location from where the script gets fetched.
Locations can be the same like for the profile (http,ftp,nfs,...).
<location>http://10.10.0.1/myScript.sh</location> | either <location> or <source> must be defined |
source | the script itself. The source code of the script if you want so. Encapsulated in a CDATA tag. If you don't want
to put the whole shell script into the XML profile, look at the location parameter.
<source> <![CDATA[ echo "Testing postpart script" > /mnt/postpart_test.txt ]]> </source> | Either <location> or <source> must be defined |
interpreter | the interpreter that must be used for the script. Supported options are shell and perl.
<interpreter>perl</interpreter> | optional (default is shell) |
filename | the filename of the script. It will be stored in a temporary directory under /tmp/...
<filename>myScript5.sh</filename> | optional. The default is the type of the script (postpartitioning-scripts in this case) |
feedback | if this boolean is true, stdout and stderr of the script will be shown in a popup that the
user has to confirm via ok-button. If stdout and stderr are empty, no popup is shown and so
no confirmation is needed.
<feedback config:type="boolean">true</feedback> | optional. The default is false. This option was invented with SL 10.1 / SLES10 |
feedback_type | this can be "message", "warning", "error" and you can control the timeout of those popups with the <report> section.
<feedback_type>warning</feedback_type> | optional. If missing, an always blocking popup is used. This option was invited with openSUSE 11.2 (not SLES11) |
debug | if this is true, every single line of a shell script is logged. Perl scripts are run with warnings
turned on.
<debug config:type="boolean">true</debug> | optional. The default is true. This option was invented with SL 10.1 / SLES10 |
notification | This text will be shown in a popup for the time the script is running in the background
<notification>Please wait while script is running ...</notification> | optional. If not configured, no notification popup will be shown. This option was invented with openSUSE 11.3 (not SLES11) |
rerun | a script is only run once. So even if you use ayast_setup to run a XML file multiple times, the script is only run once. You can change that with this boolean.
<rerun config:type="boolean">true</rerun> | optional. The default is false which makes scripts only run one time |
Chroot scripts are executed before the machine reboots for the first time. Actually chroot scripts are two differnt kind of script with one name. You can execute chroot script before the installation chroots into the installed system and configures the boot loader and you can execute a script after the chroot into the installed system has happend (look at the "chrooted" parameter for that). Both types of scripts are executed before yast2 boots for the first time.
The following elements must be between the <scripts><chroot-scripts config:type="list"><script> ... </script></chroot-scripts>...</scripts> tags
Table 4.13. chroot script XML representation
Element | Description | Comment |
---|---|---|
location | you can define a location from where the script gets fetched.
Locations can be the same like for the profile (http,ftp,nfs,...).
<location>http://10.10.0.1/myChrootScript.sh</location>
| either <location> or <source> must be defined |
source | the script itself. The source code of the script if you want so. Encapsulated in a CDATA tag. If you don't want
to put the whole shell script into the XML profile, look at the location parameter.
<source> <![CDATA[ echo "Testing the chroot script" > /tmp/chroot_out.txt ]]> </source> | either <location> or <source> must be defined |
chrooted | this value can be true or false. "False" means that the installed system is still mounted at "/mnt" and no chrooting has happened till now. The bootloader is not installed too at that stage. "True" means, we did a chroot into /mnt, so we are now in the installed system. The bootloader is installed and if you want to change anything in the installed system, you don't have to use the "/mnt/" prefix anymore.
<chrooted config:type="boolean">true</chrooted> | optional (the default is false) |
interpreter | the interpreter that must be used for the script. Supported options are shell and perl.and if you are in a chrooted=true condition, you can use python too if it's installed.
<interpreter>perl</interpreter> | optional (default is shell) |
filename | the filename of the script. It will be stored in a temporary directory under /tmp/...
<filename>myPreScript5.sh</filename> | optional. The default is the type of the script (chroot-scripts) in this case |
feedback | if this boolean is true, stdout and stderr of the script will be shown in a popup that the
user has to confirm via ok-button. If stdout and stderr are empty, no popup is shown and so
no confirmation is needed.
<feedback config:type="boolean">true</feedback> | optional. The default is false. This option was invented with SL 10.1 / SLES10 |
feedback_type | this can be "message", "warning", "error" and you can control the timeout of those popups with the <report> section.
<feedback_type>warning</feedback_type> | optional. If missing, an always blocking popup is used. This option was invited with openSUSE 11.2 (not SLES11) |
debug | if this is true, every single line of a shell script is logged. Perl scripts are run with warnings
turned on.
<debug config:type="boolean">true</debug> | optional. The default is true. This option was invented with SL 10.1 / SLES10 |
notification | This text will be shown in a popup for the time the script is running in the background
<notification>Please wait while script is running ...</notification> | optional. If not configured, no notification popup will be shown. This option was invented with openSUSE 11.3 (not SLES11) |
rerun | a script is only run once. So even if you use ayast_setup to run a XML file multiple times, the script is only run once. You can change that with this boolean.
<rerun config:type="boolean">true</rerun> | optional. The default is false which makes scripts only run one time |
These scripts are executed after AutoYaST has completed the system configuration and after it has booted the system for the first time.
It is possible to execute the post scripts in an earlier phase while the installation network is still up and before AutoYaST configures the system. To run network enabled post scripts, the boolean property network_needed has to be set to true.
The following elements must be between the <scripts><post-scripts config:type="list"><script> ... </script></post-scripts>...</scripts> tags
Table 4.14. post script XML representation
Element | Description | Comment |
---|---|---|
location | you can define a location from where the script gets fetched.
Locations can be the same like for the profile (http,ftp,nfs,...) but then you need a running network interface of course
<location>http://10.10.0.1/myPostScript.sh</location>
| either <location> or <source> must be defined |
source | the script itself. The source code of the script if you want so. Encapsulated in a CDATA tag. If you don't want
to put the whole shell script into the XML profile, look at the location parameter.
<source> <![CDATA[ echo "Testing the chroot script" > /tmp/chroot_out.txt ]]> </source> | either <location> or <source> must be defined |
network_needed | this value can be true or false. On "false" the script will run after the yast modules like the user configuration and everything else are done. The network is configured but still not up and running. With this value on "true", the script runs before(!) all yast modules are configured. So there is no local user and no network is configured but the installation network is still up and running (of course only if you did a network installation).
<network_needed config:type="boolean">true</network_needed> | optional (the default is false) |
interpreter | the interpreter that must be used for the script. Supported options are shell, perl and python if it's installed.
<interpreter>perl</interpreter> | optional (default is shell) |
filename | the filename of the script. It will be stored in a temporary directory under /tmp/...
<filename>myPostScript5.sh</filename> | optional. The default is the type of the script (post-scripts) in this case |
feedback | if this boolean is true, stdout and stderr of the script will be shown in a popup that the
user has to confirm via ok-button. If stdout and stderr are empty, no popup is shown and so
no confirmation is needed.
<feedback config:type="boolean">true</feedback> | optional. The default is false. This option was invented with SL 10.1 / SLES10 |
feedback_type | this can be "message", "warning", "error" and you can control the timeout of those popups with the <report> section.
<feedback_type>warning</feedback_type> | optional. If missing, an always blocking popup is used. This option was invited with openSUSE 11.2 (not SLES11) |
debug | if this is true, every single line of a shell script is logged. Perl scripts are run with warnings
turned on.
<debug config:type="boolean">true</debug> | optional. The default is true. This option was invented with SL 10.1 / SLES10 |
notification | This text will be shown in a popup for the time the script is running in the background
<notification>Please wait while script is running ...</notification> | optional. If not configured, no notification popup will be shown. This option was invented with openSUSE 11.3 (not SLES11) |
rerun | a script is only run once. So even if you use ayast_setup to run a XML file multiple times, the script is only run once. You can change that with this boolean.
<rerun config:type="boolean">true</rerun> | optional. The default is false which makes scripts only run one time |
These scripts are executed during the initial boot process and after YaST2 has finished. The final scripts are executed using a special init.d script which is executed only once. The final scripts are executed toward the end of the boot process and after network has been intialized.
Init scripts are configured using the tag init-scripts and
are run using the special purpose init.d script /etc/init.d/autoyast
.
The following elements must be between the <scripts><init-scripts config:type="list"><script> ... </script></init-scripts>...</scripts> tags
Table 4.15. init script XML representation
Element | Description | Comment |
---|---|---|
location | you can define a location from where the script gets fetched.
Locations can be the same like for the profile (http,ftp,nfs,...) but then you need a running network interface of course
<location>http://10.10.0.1/myInitScript.sh</location>
| either <location> or <source> must be defined |
source | the script itself. The source code of the script if you want so. Encapsulated in a CDATA tag. If you don't want
to put the whole shell script into the XML profile, look at the location parameter.
<source> <![CDATA[ echo "Testing the init script" > /tmp/init_out.txt ]]> </source> | either <location> or <source> must be defined |
filename | the filename of the script. It will be stored in a temporary directory under /tmp/...
<filename>mynitScript5.sh</filename> | optional. The default is the type of the script (init-scripts) in this case |
rerun | a script is only run once. So even if you use ayast_setup to run a XML file multiple times, the script is only run once. You can change that with this boolean.
<rerun config:type="boolean">true</rerun> | optional. The default is false which makes scripts only run one time |
When added to the control file manually, the scripts have to be included in a CDATA element to avoid confusion with the file syntax and other tags defined in the control file.
Example 4.32. Post script configuration
<?xml version="1.0"?> <!DOCTYPE profile> <profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns"> <scripts> <chroot-scripts config:type="list"> <script> <chrooted config:type="boolean">true</chrooted> <filename>chroot.sh</filename> <interpreter>shell</interpreter> <source><![CDATA[ #!/bin/sh echo "Testing chroot (chrooted) scripts" ls ]]> </source> </script> <script> <filename>chroot.sh</filename> <interpreter>shell</interpreter> <source><![CDATA[ #!/bin/sh echo "Testing chroot scripts" df cd /mnt ls ]]> </source> </script> </chroot-scripts> <post-scripts config:type="list"> <script> <filename>post.sh</filename> <interpreter>shell</interpreter> <source><![CDATA[ #!/bin/sh echo "Running Post-install script" /etc/init.d/portmap start mount -a 192.168.1.1:/local /mnt cp /mnt/test.sh /tmp umount /mnt ]]> </source> </script> <script> <filename>post.pl</filename> <interpreter>perl</interpreter> <source><![CDATA[ #!/usr/bin/perl print "Running Post-install script"; ]]> </source> </script> </post-scripts> <pre-scripts config:type="list"> <script> <interpreter>shell</interpreter> <location>http://192.168.1.1/profiles/scripts/prescripts.sh</location> </script> <script> <filename>pre.sh</filename> <interpreter>shell</interpreter> <source><![CDATA[ #!/bin/sh echo "Running pre-install script" ]]> </source> </script> </pre-scripts> <postpartitioning-scripts config:type="list"> <script> <filename>postpart.sh</filename> <interpreter>shell</interpreter> <debug config:type="boolean">false</debug> <feedback config:type="boolean">true</feedback> <source><![CDATA[ touch /mnt/testfile echo Hi ]]> </source> </script> </postpartitioning-scripts> </scripts> </profile>
After installation is finished, the scripts and the output logs can be
found in the directory /var/adm/autoinstall
. The
scripts are located in scripts
and the output logs of the
scripts are located in the log
directory.
The log is the output resulting when executing the shell scripts using the following command:
/bin/sh -x <script_name> 2&> /var/adm/autoinstall/logs/<script_name>.log