You can add scripts to further customize the image creation process. These scripts are referenced in the execution section of the manifest files. You can specify any number of custom-script checkpoints.
Often custom scripts are used to modify a configuration file or make some other changes that can not be done using a manifest.
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 in which they are listed in the execution section of the manifest file.
Standard output (stdout) and error output (stderr) of commands that are 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 the script.
Add information referencing the new script in the execution section of the manifest. To decide where to add the new checkpoint, review Setting Up Build Checkpoints.
Be sure to specify the full path to your scripts. Checkpoints are executed in the order in which 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 the 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>
You can build the image in one step or stop and restart the build at various checkpoints to check the status of the build.
For instructions, see Building an Image.
The build output displays the location of the log files.
In the following example, the image directory path is used as an argument to myscript.sh.
<checkpoint name="my-script" desc="my new script" mod_path="solaris_install/distro_const/checkpoints/custom_script" checkpoint_class="CustomScript"> <args>/tmp/myscript.sh {PKG_IMAGE_PATH}</args> </checkpoint>Example 4 Including a Short Script in a Custom DC Manifest
The following script will set the password for the solaris user which can be used to access an install client during the installation process.
<checkpoint name="set-ips-attributes" desc="Set post-install IPS attributes" mod_path="solaris_install/transfer/ips" checkpoint_class="TransferIPS"/> </checkpoint> <checkpoint name="solaris-password" desc="Set the password for the solaris account used during the installation process" mod_path="solaris_install/distro_const/checkpoints/custom_script" checkpoint_class="CustomScript"> <args>sed 's/solaris:.[^:]*:/solaris:string:/g' {PKG_IMAGE_PATH}/etc/shadow > {PKG_IMAGE_PATH}/etc/shadow.new; cp {PKG_IMAGE_PATH}/etc/shadow.new {PKG_IMAGE_PATH}/etc/shadow; rm {PKG_IMAGE_PATH}/etc/shadow.new</args> </checkpoint> <checkpoint name="pre-pkg-img-mod"