Administer > SA Provisioning > OS sequence-based provisioning > Linux build customization scripts

Linux build customization scripts

A Linux build script runs a single installation hook that gives you the ability to customize the Linux build process before Anaconda loads.

The installation hook is run in a RAM disk right before the installation program runs, but after the network has been brought up.

Linux/Itanium build process

It is important to understand the Linux/Itanium build process before you include a build customization script in a Linux/Itanium OS Installation Profile. The following table describes the exact steps that occur when you provision an installation client with Red Hat Linux, Red Hat Linux Itanium or SUSE Linux.

A user initiates the build process with Steps 1 and 6 and the rest of the build process steps happen automatically in OS Provisioning.

The build process for Red Hat Linux Itanium and VMware ESX follows the same process as the Linux build process.

Linux Build Process

Phase

Build Process Steps

Pre-installation

  1. A user boots the installation client from PXE or the Linux Boot CD ROM.
  2. The installation client loads a standard Red Hat boot image and mounts the second stage image specified by the kernel parameters.

    Note: During a PXE boot, the Build Agent is called from the kickstart file. When a CD install is specified, Anaconda is replaced by a custom SA script that is used to invoke the OS Build Agent.

  3. The OS Build Agent registers with the Build Manager.
  4. 4. The Linux build script probes the hardware configuration of the installation client and registers it with SA.

Phase One

  1. In the SA Client, a user selects the target version of Linux to install on the installation client.
  2. The Linux build script creates a small partition at the beginning of the disk and copies the target boot image from the Boot Server to this partition.
  3. The Linux build script copies GRUB or ELILO onto the partition and installs it into the MBR.
  4. The Linux build script configures GRUB or ELILO to boot this partition, and kernel arguments are set to do an NFS installation on the location indicated by the MRL.
  5. If the Custom Attribute kernel_arguments is set for the OS Installation Profile, these kernel arguments are appended.
  6. The OS Build Agent exits and the server reboots.

Phase Two

  1. The target boot image loads and runs the OS Build Agent.
  2. The Linux build script verifies that the media indicated by the MRL is the same version as the boot image under which it is running.
  3. The Linux build script writes the configuration file defined by the MRL to the disk.
  4. If it exists, the Linux build script runs the build customization script.
  5. The Linux build script runs in the background. The OS Build Agent and Anaconda starts. The Linux installation starts normally by using the configuration file written to the disk. Concurrently, the OS Build Agent monitors the installation process providing feedback, which is displayed in the SA Client.
  6. After all packages have been installed, the OS Build Agent copies the SA Agent Installer and the OS Build Agent to the server and sets up an init script to start the OS Build Agent after the reboot.
  7. When the operating system installation completes, Anaconda reboots the installation client, which boots from the newly installed operating system.

Phase Three

  1. On entering multi-user mode, the OS Build Agent is invoked and contacts the OS Build Manager.
  2. The Linux build script installs the SA Agent.
  3. The Linux build script exits.

    The operating system installation section of provisioning is complete.

Sample Solaris build customization script

#!/sbin/sh

pre_jumpstart() {

#

# strip any partitioning information out of profile, and
# replace it with keywords to use default partitioning, but
# to size swap equal to the amount of physical RAM

#

cat $SI_PROFILE | grep -v partitioning | grep -v filesys > /tmp/profile.$$

echo "partitioning default" >> /tmp/profile.$$

echo "filesys any $SI_MEMSIZE swap" >> /tmp/profile.$$

cp /tmp/profile.$$ $SI_PROFILE

rm -f /tmp/profile.$$

}

post_jumpstart() {

#

# set local-mac-address eeprom setting

#

eeprom 'local-mac-address?=true'

}

pre_agent() {

: # do nothing

}

post_agent() {

: # do nothing

}

case "$1" in

Pre-JumpStart) pre_jumpstart ;;

Post-JumpStart) post_jumpstart ;;

Pre-Agent) pre_agent ;;

Post-Agent) post_agent ;;

esac

Requirements for Linux build customization scripts

To use a build customization script for Linux, you must meet the following requirements:

  • You must create an executable script and name it run.
  • You must include the run script in an archive file in tar.gz format and include the script at the top level of the archive. During OS Provisioning, the tar.gz archive is unpacked on the installation client and the script is executed.
  • You must unpack the run script in its own directory with the other files in the archive. This directory serves as the current working directory when the run script is invoked. Based on this fact, correctly refer to the other files in the archive. For example, unpacking and invoking the run script follows this general process:

    mkdir /tmp/installhook

    cd /tmp/installhook

    tar -xzf hook.tgz

    ./run 2>&1

  • You must ensure that the run script does not take an exceptionally long time to complete, otherwise the OS Provisioning process might time out.
  • You must ensure that the run script exits normally. If the script exits with a non-zero value, the OS Provisioning process ends.
  • You must ensure that the run script has execute permissions to function properly.

VMware ESX build process

The VMware ESX build process follows the same general steps as the Linux build process.

The main difference between the VMware ESX and Linux is that VMware ESX ships by default with an iptables firewall that will block communication between the core and the mini-agent and agent. In order for the mini-agent to work correctly, build scripts add firewall rules and these rules allow the traffic needed for the mini-agent to function. The agent for VMware ESX is also enhanced to manage the necessary allow rules, which enables the flow of communication between the SA Agent and core.

The rest of the VMware ESX build process follows the same process as the Linux build process. For more information, see Linux/Itanium build process.

VMware ESX build customization scripts

The VMware ESX build script runs a single installation hook that gives you the ability to customize the VMware ESX build process before Anaconda loads.

The installation hook is run in a RAM disk right before the installation program runs, but after the network has been brought up.