The distribution constructor enables you to specify additional scripts that can be used to make customizations during the image creation process based on the type of image you are building. The manifest files point to the scripts, and the scripts transform the generic image into a media-specific distribution. These scripts are referenced in the execution section of the manifest files. Any number of custom-script checkpoints may be specified.
In addition, note that scripts specified in the execution section of the manifest file are run during the image creation process. The execution section does not reference pre-install or post-install scripts.
When you create your own custom scripts, note the following:
Scripts can be Python programs, shell scripts, or binaries.
Scripts are executed in the order that they are listed in the execution section of the manifest file.
Standard output (stdout) and error output (stderr) of commands executed within the scripts (both shell and python modules) are captured in log files that report on the completed or attempted build.
Make sure that a user assuming the root role can execute these scripts.
To decide where to a the new checkpoint, review the descriptions of the default checkpoints as described in Set Up Build Checkpoints.
Be sure to specify the full path to your scripts. Checkpoints are executed in the order they are listed in the execution section of the manifest.
When you add a reference for a new script in the execution section of a manifest file, you must specify a checkpoint name that can be used to pause the image build before or after this script performs its task. Optionally, you can include a custom message associated with the checkpoint name. If this message is omitted, the path of the script is used as the default checkpoint message. The checkpoint message displays when the checkpoint is run during the build process.
The following example checkpoint references a custom script named “my-script.”
<checkpoint name="my-script" desc="my new script" mod_path="solaris_install/distro_const/checkpoints/custom_script" checkpoint_class="CustomScript"> <args>/tmp/myscript.sh</args> </checkpoint>
Here {PKG_IMAGE_PATH} is specified as the build parameter in the arguments section.
<checkpoint name="my-script" desc="my new script" mod_path="solaris_install/distro_const/checkpoints/my_script" checkpoint_class="CustomScript"> <args>/tmp/myscript.sh {PKG_IMAGE_PATH}</args> </checkpoint>
If included in the checkpoint, the values of {PKG_IMAGE_PATH} and {BOOT_ARCHIVE} are replaced by the distro_const utility with ZFS dataset/build_data/pkg_image and ZFS dataset/build_data/boot_archive, respectively.
You can build the image in one step. Or, to check the status of the build, you can stop and restart the build at various checkpoints.
For instructions, see Chapter 3, Building an Image.
The build output displays the location of log files.