As a developer, I often have to build modified images to test out my changes. Using DC one can do this very easily. I imagine others might have similar needs, hence here is a quick tutorial.
The distro_constructor lists the set of steps required to build an ISO. One can see this by running:
distro_const build -l <config_file.xml>. Here's an output from one of my runs.
distro_const build -l slim_cd.xml
Step Resumable Description
-------------- --------- -------------
im-pop X Populate the image with packages
im-mod X Image area modifications
slim-im-mod X Slim CD Image area Modifications
br-init X Boot root initialization
slim-br-config X Slim CD boot root configuration
br-config X Boot root configuration
br-arch X Boot root archiving
slim-post-mod X Slim CD post bootroot image area modification
grub-setup X Grub menu setup
post-mod X Post bootroot image area modification
iso X ISO image creation
usb X USB image creation
Modifying an image in DC is achieved by addding an extra step. In the example below, I had to test the install changes to support booting off a multi-terabyte disk. My SUNWinstall, an SVR4 pkg, had the updated changes. Since the installer is part of the microroot, I decided that changes had to be applied after "Image area modification".
In the slim_cd.xml file these steps are called out in the finalizer class. Each step is a script sub-class which has a step name, a message and the script to call. Invoking my favorite editor (emacs!!) I searched for "<finalizer>". The following lines were added to create a new step.
<script name="/export/bld_images/mtb-pkgadd">
<checkpoint name="mtb-pkgs" message="Add MultiTB pkgs"/>
</script>
These lines were inserted after the "im-mod" step. Next, I created my script mtb-pkg. When the script is called from the distro constructor, stdin and stdout are not available. For a pkgadd to run in this mode, a private version of the admin file is required. My mtb-pkgadd script was:
#!/usr/bin/ksh93
ADMIN_FILE=/tmp/admin.$$
cat << \ADMIN_EOF > $ADMIN_FILE
mail=
instance=unique
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=nocheck
setuid=nocheck
conflict=nocheck
action=nocheck
networktimeout=60
networkretries=3
authentication=quit
keystore=/var/sadm/security
proxy=
basedir=default
ADMIN_EOF
pkgadd -a ${ADMIN_FILE} -d /brmnas/nadkarni/slim_wses/gui-changes/packages/i386/nightly-nd -R /export/bld_images/mtb/build_data/pkg_image SUNWinstall
That is really all that is need to apply the changes. Since I wanted to verify that the pkg was applied correctly, I decided to stop after mtb-pkgs step.
distro_const build -p slim-im-mod mtb.xml
DC stops at the start of the step. Running
distro_const build -l mtb.xml
Step Resumable Description
-------------- --------- -------------
im-pop X Populate the image with packages
im-mod X Image area modifications
mtb-pkgs X Add MultiTB pkgs
slim-im-mod Slim CD Image area Modifications
br-init Boot root initialization
slim-br-config Slim CD boot root configuration
br-config Boot root configuration
br-arch Boot root archiving
slim-post-mod Slim CD post bootroot image area modification
grub-setup Grub menu setup
post-mod Post bootroot image area modification
iso ISO image creation
usb USB image creation
I verified the bits and then resumed the build process by running:
distro_const build -R mtb.xml