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

Solaris build customization scripts

This section describes creating build customization scripts for Sun Solaris.

Sun Solaris build process

It is important to understand the Solaris build process before you include a build customization script for a Solaris installation profile. The following details the exact steps that occur when you provision an installation client with Solaris.

A user initiates the build process with Steps 1 and 5. The rest of the build process steps occur automatically in OS Provisioning.

Sun Solaris build process

Phase

Build Process Steps

Pre-installation

  1. A user boots the installation client over the network by entering the following command in a console attached to the server:

boot net:dhcp - install

  1. The installation client boots from the network by using a Solaris 10 JumpStart miniroot (included as part of OS Provisioning), eventually running a JumpStart begin script. The begin script is used to start the OS Build Agent.
  2. The OS Build Agent registers with the OS Build Manager.
  3. The Solaris build script probes the hardware configuration of the installation client and registers it with SA.

Phase One

  1. In the SA Client, a user chooses to install an operating system on an available installation client.
  2. The Solaris build script mounts the Solaris installation media indicated by the MRL in the OS Installation Profile that the user selected.
  3. The Solaris build script retrieves the profile associated with the selected OS Installation Profile and copies it to $SI_PROFILE, the standard JumpStart location for dynamic JumpStart profiles.
  4. The Solaris build script executes the build customization script:

/sbin/sh run Pre-JumpStart

  1. The Solaris build script validates the profile by using the JumpStart installer (pfinstall) in test mode.
  2. The Solaris build script causes the OS Build Agent to run in the background, allowing the JumpStart begin script to complete.
  3. The JumpStart installer pfinstall command is invoked by the JumpStart installer script and Solaris is installed. Concurrently, the OS Build Agent monitors the installation process. Feedback is displayed in the SA Client.
  4. The JumpStart installer pfinstall completes and runs the JumpStart finish script, which indicates to OS Provisioning that the operating system installation is complete.
  5. The build script executes the build customization script a second time:

/sbin/sh run Post-JumpStart

  1. The installation client reboots.

Phase Two

  1. On entering multiuser mode, the OS Build Agent is invoked and it contacts the OS Build Manager.
  2. The Solaris build script executes the build customization script:

/sbin/sh run Pre-Agent

  1. The Solaris build script installs the SA Agent.
  2. The Solaris build script executes the build customization script:

/sbin/sh run Post-Agent

  1. The Solaris build script exits and Phase Two finishes.
  2. OS Provisioning takes over, causing a remediation of the selected software to be installed onto the installation client.

See "Audit and compliance" in the SA 10.51 Administer section for more information on how remediation installs software on servers.

Requirements for Solaris build customization scripts

Build customization script for Solaris must meet the following requirements:

  • You must create the script as a Bourne shell script and name it run.
  • You must include the run script in an archive file in tar.Z format and include the script at the top level of the archive. During OS Provisioning, the tar.Z archive is unpacked on the installation client and the script is processed by /sbin/sh.
  • You must be sure that the run script is unpacked 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 /var/tmp/inst_hook

    cd /var/tmp/inst_hook

    zcat hook.tar.Z | tar xf -

    /sbin/sh run <stage>

  • You must create a script that cannot cause the installation client to drop its network connection (for example, do not use the script to reboot the installation client or reconfigure the active network interface). If the installation client drops its network connection, the OS Provisioning process will fail.
  • You must create the run script so that it exits normally. If the script exits with a non-zero value, the OS Provisioning process will end. However, the JumpStart process will continue when a pre-installation hook fails (exits with a non-zero value). When creating the run script, you should ensure that the JumpStart process does not continue when a pre-installation hook fails.

    The run script should not take an exceptionally long time to complete, otherwise the OS Provisioning process might time out.

    Solaris provisioning from a boot server on a Red Hat/SLES 10 Linux server

    If you must provision a Solaris server and the Boot Server is hosted on a Red Hat Enterprise Linux or Suse Linux Enterprise 10 server, you must disable NFS v3 on the Boot Server. If the Boot Server is on a Solaris server, do not perform this action.

    Disabling NFS v3 or NFS v4

    To disable NFS v3, perform the following steps:

    1. On the Boot Server host, create the following file:

      /etc/sysconfig/nfs

    2. In the newly created nfs file, add the following line:

      MOUNTD_NFS_V3=no

    3. Restart NFS:

      /etc/init.d/nfs stop

      /etc/init.d/nfs start

    To disable NFS v4 on a Red Hat Linux Boot Server host, perform the following steps:

    1. On the Boot Server host, create the following file:

      /etc/sysconfig/nfs

    2. In the newly created nfs file, add the following lines:

      MOUNTD_NFS_V3=no

      MOUNTD_NFS_V2=yes

      RPCNFSDARGS='--no-nfs-version 4

    3. Restart NFS:

      /etc/init.d/nfs stop

      /etc/init.d/nfs start

    To disable NFS v4 on an SLES 10 Boot Server host:

    1. On the Boot Server host, create the following file:

      /etc/sysconfig/nfs

    1. In the newly created nfs file, add the following line:

      NFS4_SUPPORT="no"

    1. Restart NFS:

      /etc/init.d/nfsserver stop

      /etc/init.d/nfsserver start

Creating a Solaris build customization script

You can customize a Solaris installation at multiple points using a build customization script. The following list shows these points:

  • Pre-JumpStart: A pre-installation hook for the first stage.

    During Phase One, the build customization script runs in the JumpStart environment. The script can use all the standard JumpStart environment variables, such as
    SI_PROFILE. All the environment variables associated with the standard JumpStart probe keywords and values are set (for example, SI_DISKLIST, SI_HOSTADDRESS, and SI_MEMSIZE).

    When the run script is invoked at the Pre-JumpStart point, it can perform any actions that a JumpStart begin script would perform. For example, the script could modify the downloaded profile before the operating system installation begins. At this point, the Solaris profile is downloaded from OS Provisioning, but the profile has not been passed to the JumpStart server.

    For the complete list of the environment variables, see the Solaris 9 Installation Guide.

  • Post-JumpStart: A post-installation hook for the first stage.

    When the run script is invoked at the Post-JumpStart point, it can perform any actions that a JumpStart finish script would perform. One example would be to set custom eeprom settings. The installation client’s file systems are available for modification at this point and are mounted on the /a partition for the finish script environment.

  • Pre-Agent: A pre-installation hook for the second stage.
  • Post-Agent: A post-installation hook for the second stage.

    During Phase Two, the run script is executed after the installation client has rebooted. This is the point when the system is up and running in multi-user mode with most services started.

    The last 4K of output produced by the build customization script (stdout and stderr) appears in the SA Client output details of the run job window.

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