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, three types of scripts can be executed:
Pre-Install Scripts
Executed before YaST2 does any real change to the system (Before partitioning and package installation)
![]() | 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) |
Post-Install Scripts
These scripts are executed after AutoYaST has completed the system configuration and after it has booted the system for the first time.
Starting from SLES9, network is not available during post-installation script execution. To access the network, network device has to be configured in the script.
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.
Final Scripts
![]() | Note |
---|---|
Available starting from SLES9 only. |
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.
Final scripts are configured using the tag init-scripts and are run using the special purpose init.d script /etc/init.d/autoyast.
Chroot environment post-install scripts
Chroot scripts are executed after all packages have been installed and before YaST2 boots for the first time and before the boot loader is installed. Although the name of this type of scripts might imply that the scripts executed in the chroot environment, the scripts are actually executed in the system before it was mounted. To make any changes to the system, the prefix /mnt has to be used to any path.
It is also possible to run the chroot scripts in the installed system by adding the boolean element chrooted. When run chrooted, the scripts are executed later in the process than when not chrooted and after most configuration operations have been completed in system, i.e. writing bootloader configuration.
![]() | New Feature |
---|---|
It is now possible to have the scripts outside the control file. The location of the control file can be specified using a URL similar to the syntax used for referencing the location of the control file. The location of the external script should be specified using the location element. This new option does not work with Chroot Scripts. |
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.38. Post script configuration
<?xml version="1.0"?> <!DOCTYPE profile SYSTEM "/usr/share/autoinstall/dtd/profile.dtd"> <profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns"> <configure> <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> </scripts> </configure> </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 |