<!-- 
The contents of this Documentation are subject to the Public Documentation
License Version 1.01 (the "License"); you may only use this Documentation if
you comply with the terms of this License. A copy of the License is
available at http://www.opensolaris.org/os/community/documentation/license.
-->

<chapter id="index"><title>Introduction to the Distribution Constructor</title><highlights><para>The distribution constructor is a tool that application developers can
use to build their own custom <trademark>OpenSolaris</trademark> image which
they can then distribute to their contacts and customers.</para><itemizedlist><listitem><para>If you have not used the distribution constructor before,
read this introduction. Then, install the tool on your system, using the instructions
at <olink type="auto-generated" targetptr="setup" remap="internal">Setup for
the Distribution Constructor.</olink>.</para>
</listitem><listitem><para>If you are already familiar with the distribution constructor
tool, go to <olink type="auto-generated" targetptr="using" remap="internal">Using the Distribution Constructor</olink> for detailed instructions about
how to design and create images.</para>
</listitem>
</itemizedlist>
</highlights><sect1 id="overview"><title>What is the Distribution Constructor?</title><para>The distribution constructor is a command-line tool for building preconfigured,
bootable OpenSolaris images. This tool takes an XML manifest file as input,
and builds an ISO image that is based on the parameters specified in the manifest
file. Optionally, a USB image can be created, based on the generated ISO image.</para><para>An ISO image or a USB image is a collection of software in a single
file. These images are bootable and can be used for installation and other
purposes. Both ISO images and USB images can be distributed on the Internet.
 The ISO image needs to be burned into a CD/DVD before use.  The USB image
needs to be copied into a USB flash drive by using a special Solaris utility.</para><note><para>The Distribution Constructor outputs a USB image that could work
in other types of flash memory devices, if that device has driver support
provided by the OpenSolaris release. The <command>usbcopy</command> utility
is the only utility that can be used to copy the USB image into a USB flash
drive. This <command>usbcopy</command>utility is available with the OpenSolaris
release.</para>
</note><sect2 id="types"><title>What Kind of Images Can I Create?</title><para>You can use the distribution constructor to create the following types
of OpenSolaris images:</para><itemizedlist><listitem><para><emphasis role="strong">OpenSolaris 2009.06 x86 Slim CD</emphasis> &ndash; Using the distribution constructor, you can create an x86 ISO image
that is comparable to the Live CD image that's distributed as the OpenSolaris
2009.06 release. And, you can modify the content of this ISO image, selecting
and adding additional packages to the image. You can revise the default settings
for the resulting booted environment to create a custom, redistributable ISO
image or USB image.</para>
</listitem><listitem><para><emphasis role="strong">x86 ISO Image for Automated Installations</emphasis></para>
</listitem><listitem><para><emphasis role="strong">SPARC ISO Image for Automated Installations</emphasis></para><para>The OpenSolaris 2009.06 release includes the automated installer
tool. The automated installer (AI) is used to automate the installation of
the OpenSolaris OS on one or more SPARC and x86 systems over a network. The
installations can differ in architecture, packages installed, disk capacity,
and other parameters. The automated installer uses a SPARC or x86 AI ISO image
to install the OpenSolaris OS to client systems. You can use the distribution
constructor to create a SPARC AI ISO image that can be used to install the
OpenSolaris OS on SPARC clients, or to create an x86 AI ISO image that can
be used to install the OpenSolaris OS on x86 clients.</para><para>For information about using the automated installer, see the <ulink url="http://dlc.sun.com/osol/docs/content/2009.06/AIinstall/" type="text">OpenSolaris Automated Installer Guide</ulink>. </para><note><para>When using the distribution constructor, you can only create SPARC
images on a SPARC system. And, you can only create x86 images on an x86 system.</para><para>To see the system requirements for using the distribution constructor,
see <olink targetptr="setup" remap="internal"></olink>.</para>
</note>
</listitem>
</itemizedlist>
</sect2>
</sect1><sect1 id="how"><title>How does the Distribution Constructor Work?</title><para>The distribution constructor tool uses the following components:</para><itemizedlist><listitem><para><olink targetptr="manifests" remap="internal"></olink></para><para>The distribution
constructor creates images based on settings specified in a file.  This file
is the blueprint from which every image is built.  This blueprint is an XML
file called a <emphasis>manifest file</emphasis>. Sample manifest files with
preset values are included in the distribution constructor package. You can
manually edit a manifest file to customize the ISO images you create.</para>
</listitem><listitem><para><olink targetptr="finalizers" remap="internal"></olink></para><para>The distribution
constructor enables you to specify scripts or programs that can be used to
make installation customizations based on the type of image you are building.
 These scripts are called <emphasis>finalizer scripts</emphasis>. The distribution
constructor package  includes the set of scripts that are used for creating
the Slim Live CD and AI ISO images. It is recommended that you use the supplied
finalizer scripts without editing them. You do, however, have the option to
write and add your own scripts to perform additional operations.</para>
</listitem><listitem><para><olink targetptr="utility" remap="internal"></olink> with <olink targetptr="checkpointing" remap="internal"></olink></para><para>The distribution constructor
package also includes a command-line utility, the <command>distro_const</command> command, that actually builds your image for you. After you've finished
editing the image blueprint in a manifest file to suit your requirements,
you run the <command>distro_const</command> command to build your image. You
can use the options provided in the <command>distro_const</command> command
to stop and restart the build process at various stages, in order to check
and debug the image that is being built. This process of stopping and restarting
during the build process is called <emphasis>checkpointing</emphasis>.</para>
</listitem>
</itemizedlist><sect2 id="components"><title>Components of the Distribution Constructor</title><para>The following section describes each of the components of the distribution
constructor application more fully.</para><sect3 id="manifests"><title>Manifests</title><para>XML manifest files contain specifications for the contents and parameters
of the ISO images that you create using the distribution constructor. The
distribution constructor contains default manifests that can be used to create
a custom Slim CD, an x86 AI ISO image, or a SPARC AI ISO image.</para><para>Manifests specify parameters such as the following:</para><itemizedlist><listitem><para>Names of the packages to be included in the image</para>
</listitem><listitem><para>Network location of the repository to access to retrieve packages
for the image</para>
</listitem><listitem><para>Name and location of scripts used to finalize the creation
of the new image</para>
</listitem>
</itemizedlist><para>All the fields in each manifest file provide preset, default values
that will create the type of ISO image you need. Optionally, you can manually
edit these preset fields in a manifest file to further customize the resulting
image.</para><para>For instructions about editing manifest files, see <olink type="auto-generated" targetptr="manifest" remap="internal">Setting Up the Manifest</olink>.</para>
</sect3><sect3 id="finalizers"><title>Finalizer Scripts</title><para>A manifest file points to scripts that are used to customize the new
image. These finalizer scripts transform the generic image into a media-specific
distribution. The default scripts that are provided in the application packages
generate ISO images for either an x86 Slim CD, an x86 AI ISO image, or a SPARC
AI ISO image. Start with the default scripts, and with caution, add your own
scripts to supplement. Edit the manifest file to point to any new scripts.</para><note><para>While custom scripts are needed to create your own custom image,
support for scripts is limited to the unmodified scripts that are supplied
with the application packages. If you choose to customize these scripts, backup
the original scripts first.</para>
</note><para>For further information about these scripts and how to customize them,
see <olink type="auto-generated" targetptr="scripts" remap="internal">Customizing
the Finalizer Scripts</olink>.</para>
</sect3><sect3 id="utility"><title>distro_const Utility</title><para>After setting up the manifest and, optionally, customizing the finalizer
scripts, you build an image by using the <command>distro_const</command> utility
from the command line.</para><para>For further information, see <olink type="auto-generated" targetptr="distro_const" remap="internal">Creating an Image</olink>.
See also the <citerefentry><refentrytitle>distro_const</refentrytitle><manvolnum>1M</manvolnum></citerefentry> man page.</para>
</sect3><sect3 id="checkpointing"><title>Checkpointing Options</title><para>The distribution constructor provides the ability to pause, or &ldquo;checkpoint,&rdquo;
and resume at certain stages of the image-generation process. This checkpointing
feature supports the process of developing and debugging images. You can start
building an image, pause at any stage where you want to stop and examine the
contents of the image, then resume building the image. Checkpointing is optional.</para><note><para>A checkpoint in the build process is created after each finalizer
script is executed.  So, new checkpoint references are added when you add
new finalizer scripts.</para>
</note><para>You use this feature by taking advantage of the checkpointing options
that are available in the <command>distro_const</command> command. Run the
command to check which checkpoints are available, then build your image with
any checkpoint options that you choose.</para><para>For instructions, see <olink type="auto-generated" targetptr="checkpoint" remap="internal">Using Checkpointing</olink>. See also the <citerefentry><refentrytitle>distro_const</refentrytitle><manvolnum>1M</manvolnum></citerefentry> man page.</para>
</sect3>
</sect2>
</sect1><sect1 id="diffs"><title>SPARC and x86 Differences</title><itemizedlist><para>When you use the distribution constructor to create ISO images, there
are a few differences between creating images for SPARC systems and for x86
systems:</para><listitem><para>To prepare to use the distribution constructor, you can download
an x86 Live CD image and use it to install the OpenSolaris OS on your x86
system. However, there are no SPARC Live CD images. Instead, you must use
the automated installer to install the OpenSolaris OS on a SPARC system. Then
you can use the distribution constructor on that SPARC system.</para><para>For information about using the automated installer, see the <ulink url="http://dlc.sun.com/osol/docs/content/2009.06/AIinstall/" type="text">OpenSolaris
Automated Installer Guide</ulink>. </para>
</listitem><listitem><para>The root archive for x86 images differs from the root archive
for SPARC images. The whole root archive, or <literal>bootroot</literal>,
for x86 images is a UFS filesystem, compressed by using <literal>lzma</literal>.  The SPARC platform does not support the compression of the whole root
archive in this way.  Instead, SPARC root archives use DCFS, which compress
each file individually. These individually compressed files might require
specific handling in the manifest. For instructions, see <literal>&lt;bootroot_contents&gt;</literal> in <olink targetptr="mantbl" remap="internal"></olink>.</para>
</listitem>
</itemizedlist>
</sect1>
</chapter><chapter id="setup"><title>Setup for the Distribution Constructor</title><highlights><para>In order to use the distribution constructor, you must have the following
set up on your system.</para>
</highlights><sect1 id="sysreq"><title>System Requirements</title><table frame="topbot" pgwide="1"><title>System Requirements</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="28.79*"/><colspec colwidth="71.21*"/><thead><row rowsep="1"><entry><para>Requirement</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para>Disk Space</para>
</entry><entry><para>Confirm that you have sufficient space on your system to use the distribution
constructor. The recommended minimum size for your distribution constructor
work space is 8 Gbytes.</para>
</entry>
</row><row><entry><para>OpenSolaris 2009.06 release</para>
</entry><entry><para>Install the SPARC or x86 OpenSolaris 2009.06 operating system (OS) on
your system.</para><itemizedlist><para>When using the distribution constructor, you can only create SPARC images
on a SPARC system. And, you can only create x86 images on an x86 system.</para><listitem><para>X86 Slim CD images for the OpenSolaris 2009.06 operating system,
also called Live CD images, can be downloaded from <ulink url="http://www.opensolaris.com/get/" type="url"></ulink>. For instructions about installing
the OpenSolaris release from the Live CD onto your x86 system, see <ulink url="http://dlc.sun.com/osol/docs/content/2009.06/getstart/" type="text">Getting
Started With OpenSolaris</ulink>.</para>
</listitem><listitem><para>SPARC Slim CD images are not supported. However, you can use
the automated installer to install the SPARC OpenSolaris OS on your system.
For information about using the automated installer, see the <ulink url="http://dlc.sun.com/osol/docs/content/2009.06/AIinstall/" type="text">OpenSolaris
Automated Installer Guide</ulink>.</para>
</listitem>
</itemizedlist><note><para>Your installed OpenSolaris system must have network access.</para><para>Specifically, the distribution constructor accesses Image Packaging
System (IPS) repositories that are available on the network to retrieve packages
for the ISO image. You must have network access to the repositories that you
specify in the manifest file.</para><para>Also, note that you must run the
distribution constructor as root.</para>
</note>
</entry>
</row><row><entry><para>Required packages</para>
</entry><entry><para>Install the <filename>SUNWdistro-const</filename> package, which contains
the distribution constructor application, on your system.</para><para>You can use the Package Manager tool to install the required package.
The Package Manager is available on the menu bar on the desktop of the OpenSolaris
2009.06 operating system. On the menu bar, go to System&gt;Administration&gt;Package
Manager.</para><para>Alternately, use IPS commands such as the following to install this
package:</para><screen># <command>pkg install <replaceable>SUNWdistro-const</replaceable></command></screen>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1><sect1 id="files"><title>Distribution Constructor Files</title><para>When you've installed the <filename>SUNWdistro-const</filename> package
on your system, you have the following tools, scripts, and utilities available
to design and build custom, preconfigured OpenSolaris images.</para><table frame="topbot" pgwide="1"><title>Distribution Constructor Files</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="37.68*"/><colspec colwidth="62.32*"/><thead><row rowsep="1"><entry><para>File Location</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><filename>/usr/bin/distro-const</filename></para>
</entry><entry><para>Distribution constructor application</para>
</entry>
</row><row><entry><para><filename>/usr/bin/usbcopy</filename></para><para><filename>/usr/bin/usbgen</filename></para>
</entry><entry><para>Tools for generating and copying USB images</para>
</entry>
</row><row><entry><para><filename>/usr/bin/proc_tracedata</filename></para><para><filename>/usr/bin/proc_slist</filename></para>
</entry><entry><para>Tools for generating the ISO sort file</para>
</entry>
</row><row><entry><para><filename>/usr/share/distro_const</filename></para>
</entry><entry><para>Configuration, data, and utilities files used by the distribution constructor
application</para>
</entry>
</row><row><entry><para><filename>/usr/share/distro_const/slim_cd</filename></para>
</entry><entry><para>Configuration, data, and utilities files used to create an x86 Slim
CD ISO image, including a default <filename>all_lang_slim_cd_x86.xml</filename> manifest file.</para>
</entry>
</row><row><entry><para><filename>/usr/share/distro_const/auto_install</filename></para>
</entry><entry><para>Configuration, data, and utilities files used to create AI ISO images
for x86 or SPARC automated installations, including the manifest files: <filename>ai_sparc_image.xml</filename> and <filename>ai_x86_image.xml</filename>.</para>
</entry>
</row><row><entry><para><filename>/usr/share/man/man1m/distro_const</filename></para><para><filename>/usr/share/doc/distro_const/index.html</filename></para>
</entry><entry><para>Documentation for the distribution constructor, including the following:</para><itemizedlist><listitem><para><citerefentry><refentrytitle>distro_const</refentrytitle><manvolnum>1M</manvolnum></citerefentry> man page</para>
</listitem><listitem><para><citetitle>OpenSolaris Distribution Constructor Guide</citetitle></para><note><para>This document is also available at <ulink url="http://dlc.sun.com/osol/docs/content/2009.06/DistroConst/" type="url"></ulink>.</para>
</note>
</listitem>
</itemizedlist>
</entry>
</row>
</tbody>
</tgroup>
</table><note><para>The distribution constructor and finalizer scripts require files
provided by the <filename>SUNWinstall</filename> package, including the <filename>/usr/bin/ManifestRead</filename> file and files  in <filename>/usr/lib/python2.4/vendor-packages/osol_install</filename>.</para><para><filename>SUNWinstall</filename> also includes <filename>/usr/bin/ManifestServ</filename>,  which can be used as a debugging tool for XML manifests.</para>
</note><para>Once you have successfully set up the distribution constructor on your
system, you are ready to build your own custom images. See <olink type="auto-generated" targetptr="using" remap="internal">Using the Distribution
Constructor</olink> for detailed instructions about designing and building
custom images.</para>
</sect1>
</chapter><chapter id="using"><title>Using the Distribution Constructor</title><highlights><para><emphasis role="strong">Prerequisites:</emphasis> If you have not used
the distribution constructor before, read <olink type="auto-generated" targetptr="index" remap="internal">Introduction to the Distribution Constructor</olink>. Then, install the application on your system, using the instructions at <olink type="auto-generated" targetptr="setup" remap="internal">Setup for the Distribution
Constructor.</olink>.</para><para>Once you have installed the distribution constructor application on
your system, you are ready to use this tool to design and build custom images.
This process includes the following three basic steps:</para><itemizedlist><listitem><para>Optional: <olink type="auto-generated" targetptr="manifest" remap="internal">Editing the Manifest File</olink></para>
</listitem><listitem><para>Optional: <olink type="auto-generated" targetptr="scripts" remap="internal">Using the Finalizer Scripts</olink></para>
</listitem><listitem><para><olink type="auto-generated" targetptr="distro_const" remap="internal">Creating an Image</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="manifest"><title>Editing the Manifest Files</title><para>The <filename>SUNWdistro-const</filename> package that you installed
on your system includes default manifest files. These XML manifest files provide
the distribution constructor with the blueprints that specify the contents
and parameters of the image that you plan to build. </para><para>The default manifest files included in the <filename>SUNWdistro-const</filename> package are:</para><itemizedlist><listitem><para><emphasis role="strong">Manifest for x86 ISO image &ndash;</emphasis> Located at <filename>/usr/share/distro_const/slim_cd/all_lang_slim_cd_x86.xml</filename>, this manifest is used to create an ISO image comparable to the OpenSolaris
2009.06 Live CD. To view the contents of the x86 Slim CD manifest, see <olink type="auto-generated" targetptr="appendix" remap="internal">Sample Manifest
File</olink>.</para>
</listitem><listitem><para><emphasis role="strong">Manifest for SPARC AI ISO image &ndash;</emphasis> Located at <filename>/usr/share/distro_const/auto_install/ai_sparc_image.xml</filename>, this manifest is used to create a SPARC AI ISO image for automated installations
of the OpenSolaris OS to SPARC clients.</para>
</listitem><listitem><para><emphasis role="strong">Manifest for x86 AI ISO image &ndash;</emphasis> Located at <filename>/usr/share/distro_const/auto_install/ai_x86_image.xml</filename>, this manifest is used to create an x86 AI ISO image for automated installations
of the OpenSolaris OS to x86 clients.</para>
</listitem>
</itemizedlist><para>You do not need to modify the default manifest files. However, you can
edit them if you wish. The following table summaries some of the key sections
in the manifest file and provides further instructions about how you can customize
these sections.</para><note><para>When using the distribution constructor, you can only create SPARC
images on a SPARC system. And, you can only create x86 images on an x86 system.</para>
</note><table frame="topbot" pgwide="1" id="mantbl"><title>Primary Manifest Sections</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="17.90*"/><colspec colwidth="43.05*"/><thead><row rowsep="1"><entry><para>Section XML Tags</para>
</entry><entry><para>Description of Required Manual Edits</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>&lt;distribution name="OpenSolaris"&gt;</literal></para>
</entry><entry><para>This section provides a default name for the distribution.</para><para>You can leave the default name or type a unique name for your distribution.</para>
</entry>
</row><row><entry><para><literal>&lt;checkpoint_enable&gt;</literal></para>
</entry><entry><para>The default setting in this section enables checkpointing when you create
the image. You can use checkpointing to pause while building an image for
testing purposes. Checkpointing is described later in this topic.</para>
</entry>
</row><row><entry><para><literal>&lt;pkg_repo_default_authority&gt;</literal></para>
</entry><entry><para>This section specifies the location of the IPS repository. The constructor
accesses the repository and retrieves packages for the image when the image
is being built. The default repository location is <ulink url="http://pkg.opensolaris.org/release" type="url"></ulink>.</para><para>If you do not want to use the opensolaris.org repository, modify this
location to point to the repository of your choice. To view a list of some
of the alternate repositories, see <ulink url="http://dlc.sun.com/osol/docs/content/2009.06/IMGPACKAGESYS/giifx.html" type="text">OpenSolaris Repositories</ulink>.</para>
</entry>
</row><row><entry><para><filename>&lt;packages&gt;</filename></para>
</entry><entry><para>This section lists the packages to be included in the image.</para><para>If you have packages that you want to add to the image, list your packages
in this field, one package per line.</para>
</entry>
</row><row><entry><para><filename>&lt;bootroot_contents&gt;</filename></para>
</entry><entry><para>This section lists the default files and directories that will be included
in the boot root for the image that is built. Files or directories that need
to be excluded from the image are specified with the <filename>base_exclude</filename> tag.</para><caution><para>It is recommended that you <emphasis>not</emphasis> edit the
boot root contents with the following exception. Modifying the boot root contents
might cause the system to fail to boot.</para>
</caution><para>The root archive for x86 images differs from the root archive for SPARC
images. The whole root archive, or bootroot, for x86 images is a UFS filesystem,
compressed by using <literal>lzma</literal>.  The SPARC platform does not
support the compression of the whole root archive in this way.  Instead, SPARC
root archives use DCFS, which compress each file individually. These individually
compressed files might require specific handling in the manifest.</para><para>During boot time, some of the files in the root archive need to be modified.
But, compressed files cannot be modified. Therefore, for SPARC images, you
need to specify in the manifest which files should not be compressed. In the
finalizer section of the manifest, find the reference to the <literal>boot_archive.py</literal> script. By default, this script specifies that all the files and directories
in the <literal>/boot/solaris/filelist.ramdisk</literal> file, and all the
files and subdirectories under the <literal>usr/kernel</literal> directory,
are uncompressed. You must specify any additional files that need to be in
uncompressed state in the bootroot by setting the <literal>fiocompress=false</literal> option in the manifest for those files.</para>
</entry>
</row><row><entry><para><filename>&lt;build_area&gt;</filename></para>
</entry><entry><para>This section specifies the area where the image will be created.</para><para>You must check that the package image area specified is valid for your
system and revise as needed.</para><para>If you want to use checkpointing, you must specify a ZFS dataset, or
a mount point that correlates to a ZFS dataset, as your build area. If the
ZFS dataset does not exist, it will be created. The zpool that you specify,
however, must already exist.</para><para>If you do not want to use checkpointing, you can use either a regular
mount point or a ZFS or UFS file system.</para><note><para>After an image has been created, the build area for that image
has the following structure.</para><itemizedlist><listitem><para><filename>&lt;build_area&gt;/build_data/pkg_image</filename> &ndash;
Package image area.</para>
</listitem><listitem><para><filename>&lt;build_area&gt;/build_data/bootroot</filename> &ndash;
Boot root build area.</para>
</listitem><listitem><para><filename>&lt;build_area&gt;/build_data/tmp</filename> &ndash;
Temporary directory used by constructor and finalizer scripts.</para>
</listitem><listitem><para><filename>&lt;build_area&gt;/media</filename> &ndash; Area where
the output images are placed.</para>
</listitem><listitem><para><filename>&lt;build_area&gt;/logs</filename> &ndash; Area that
holds log files which record the steps executed by the application and the
output from all commands.</para><para>The &ldquo;simple&rdquo; log, named <literal>simple-log-YYYY-MM-DD-HH-Mi-SS</literal>, contains only errors. The  &ldquo;detail&rdquo;
log, named <literal>detail-log-YYYY-MM-DD-HH-Mi-SS</literal>, contains informational
output and errors. The console echos information in the &ldquo;simple&rdquo;
log file.</para>
</listitem>
</itemizedlist>
</note>
</entry>
</row><row><entry><para><filename>&lt;finalizer&gt;</filename></para>
</entry><entry><para>This section specifies the finalizer scripts that the distribution constructor
invokes and the order in which the distribution constructor invokes them.</para><para>Default finalizer scripts are provided in the <command>distro_const</command> package and automatically referenced in this section of the manifest file.
You do not need to edit this section unless you add new finalizer scripts,
or you change the name or the <filename>argslist</filename> of existing scripts.</para>
</entry>
</row><row><entry><para><filename>&lt;key_value_pairs&gt;</filename></para>
</entry><entry><para>This section specifies additional parameters that are needed by the
distribution constructor or by the finalizer scripts. Default parameters are
provided.</para><para>You do not need to edit the default key-value pairs except to add new
ones that will be recognized by new or customized finalizer scripts.</para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>You can either use one of the default manifest files, or you can copy
a default manifest and create a custom manifest file with a new file name.
You will reference the manifest file by name when you use the <command>distro_const</command> command to create an image.</para><para>If the default scripts do not leave the <filename>build_area</filename> as you need it, you can create your own scripts to make further modifications.
If you do create new scripts, you'll need to update the script references
in the finalizer section of the manifest file.</para><note><para>Always backup the original manifest file and the default scripts
before copying them. Your custom scripts are not supported.</para>
</note><para>When you have completed any revisions to the manifest file and, optionally,
customized the finalizer scripts as described in the next section, you can
proceed with running the <command>distro_const</command> utility to create
an image.</para>
</sect1><?SolBook prefpagebreak?><sect1 id="scripts"><title>Using the Finalizer Scripts</title><para>The distribution constructor application includes default scripts in
the <filename>/usr/share/distro_const</filename> directory and subdirectories.
These scripts are referenced in the finalizer section of the manifest files.</para><note><para>It is recommended that you use the default scripts without editing
them. You do have the option to write your own scripts to perform additional
operations.</para>
</note><itemizedlist><para>For example, some of the finalizer scripts that are used to create an
x86 Slim CD are as follows:</para><listitem><para><filename>pre_bootroot_pkg_image_mod</filename> &ndash; Image
area modifications for all types of images</para>
</listitem><listitem><para><filename>slim_cd/slimcd_pre_bootroot_pkg_image_mod</filename> &ndash; Image area modifications specific to Slim CD</para>
</listitem><listitem><para><filename>slim_cd/slimcd_gen_cd_content</filename> &ndash;
Generate the list of files that are part of the Slim Live CD image.</para>
</listitem><listitem><para><filename>bootroot_initialize.py</filename> &ndash; Boot-root
initialization</para>
</listitem><listitem><para><filename>slim_cd/slimcd_bootroot_configure</filename> &ndash;
Boot-root configuration specific to Slim CD</para>
</listitem><listitem><para><filename>bootroot_configure</filename> &ndash; Boot-root
configuration</para>
</listitem><listitem><para><filename>bootroot_archive.py</filename> &ndash; Boot-root
archiving</para>
</listitem><listitem><para><filename>slim_cd/slimcd_post_bootroot_pkg_image_mod</filename> &ndash; Post-boot-root image area modification specific to Slim CD</para>
</listitem><listitem><para><filename>grub_setup</filename> &ndash; Initialization of
grub menu</para>
</listitem><listitem><para><filename>post_bootroot_pkg_image_mod</filename> &ndash; Post-boot-root
image area modification</para>
</listitem><listitem><para><filename>create_iso</filename> &ndash; ISO image creation</para>
</listitem><listitem><para><filename>create_usb</filename> &ndash; USB image creation</para>
</listitem>
</itemizedlist><para>These finalizer scripts are referenced in the finalizer section of the
Slim CD manifest. You can view the complete contents of the default Slim CD
manifest, including the finalizer section where the scripts are referenced,
at <olink type="auto-generated" targetptr="manifestfile" remap="internal">Sample Manifest File</olink>.</para><note><para>Some of the scripts listed above are also used to create SPARC
or x86 ISO images for automated installations. But, the automated installer
manifests reference other finalizer scripts that are specific to the SPARC
or x86 automated installation processes.</para>
</note><sect2 id="customscripts"><title>Customizing Finalizer Scripts</title><para>You can use the default scripts without editing them. However, you can
also create custom scripts to perform additional tasks as follows: </para><orderedlist><listitem><para>Create new scripts by using the existing scripts as models
for your new scripts. Review the characteristics of finalizer scripts as described
below. Also, see the custom script examples that are provided below.</para>
</listitem><listitem><para>Add your new scripts to the <filename>/usr/share/distro_const</filename> directory or anywhere on the system or network. Make sure that root can
execute these scripts.</para>
</listitem><listitem><para>Add the new script names in the finalizer section of the appropriate
manifest file. Be sure to specify the full path to your scripts in the manifest
file, even if they are in the <filename>/usr/share/distro_const</filename> directory.</para>
</listitem><listitem><para>When you add a reference for a new script in the finalizer
section of a manifest file, you must specify a checkpoint name that is 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.</para><note><para>Use meaningful names for checkpoint names instead of using numbers.
If new scripts are added, the new steps for those new scripts will disrupt
a prior numbered checkpoint order. </para>
</note><para>For example, the following reference in a manifest file specifies the
checkpoint name of &ldquo;br-arch&rdquo; for a boot root archiving script,
and the associated message is &ldquo;Boot root archiving.&rdquo;</para><screen><literal>&lt;script name="/usr/share/distro_const/bootroot_archive.py"&gt;</literal>
<literal>&lt;checkpoint name="br-arch" message="Boot root archiving"/&gt;</literal></screen><para>In this example, when you build your image, you could refer to the &ldquo;br-arch&rdquo;
checkpoint in the <command>distro_const</command> command. This checkpoint
would enable you to pause building the image just before the boot root archiving
script performs its task.</para><para>For instructions about how to refer to checkpoints in the <command>distro_const</command> command, see <olink type="auto-generated" targetptr="checkpoint" remap="internal">Using Checkpointing to Create an Image</olink>.</para><para>To see further examples of finalizer script references, see the finalizer
section of the <olink type="auto-generated" targetptr="manifestfile" remap="internal">Sample Manifest File</olink>.</para>
</listitem>
</orderedlist><sect3 id="characteristics"><title>Characteristics of Finalizer Scripts</title><itemizedlist><para>When you create your own scripts, note the following characteristics
of the finalizer scripts:</para><listitem><para>Scripts can be Python programs, shell scripts, or binaries.</para>
</listitem><listitem><para>Scripts are executed in the order that they are listed in
the manifest file.</para>
</listitem><listitem><para>The <filename>stdout</filename> and <filename>stderr</filename> information for the scripts is captured in the log files.</para>
</listitem><listitem><para>The <literal>argslist</literal>, which can accept a list of
items, uses double-quotes to delimit the list arguments. When no double-quotes
are  used, or if one set of double-quotes envelopes the entire string, the
entire string including spaces and newlines is interpreted as one argument.
Do not use commas between arguments.</para>
</listitem><listitem><para>The distribution constructor passes five initial arguments
to all scripts which are executed. These five arguments are not included as
entries in the manifest file. The manifest file specifies additional arguments
passed in after these five arguments. The initial arguments are as follows:</para>
</listitem>
</itemizedlist><table frame="topbot" pgwide="1"><title>Finalizer Script Arguments</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="18.56*"/><colspec colwidth="81.44*"/><thead><row rowsep="1"><entry><para>Argument</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para>Server socket file name</para>
</entry><entry><para>The first argument is the manifest reader socket. This argument specifies
the socket that is used with <literal>/usr/bin/ManifestRead</literal> for
accessing the manifest data. See the section below about <olink type="auto-generated" targetptr="manifestreader" remap="internal">Using the <filename>ManifestReader</filename></olink>.</para>
</entry>
</row><row><entry><para>Package image area path</para>
</entry><entry><para>The second argument is the <literal>PKG_IMG_PATH</literal>, which specifies
the path to the area where the package image is created. Use this argument
to locate a file in the package image area. The  following example checks
whether the user &ldquo;jack&rdquo; is in the password file.</para><screen remap="">PKG_IMG_PATH=$2
/usr/bin/grep jack $PKG_IMG_PATH/etc/passwd &gt;/dev/null
if [[ $? == "0" ]] ; then
   print "Found Jack"
fi </screen>
</entry>
</row><row><entry><para>Temp directory</para>
</entry><entry><para>The third argument specifies a directory that is used when creating
temporary files needed during the build process.  In the following example,
we want to create a file in the temporary directory for building the boot
root.</para><screen remap="">TMP_DIR=$3
/usr/sbin/mkfile $TMP_DIR/bootroot_archive
/usr/sbin/lofiadm -a $TMP_DIR/bootroot_archive </screen>
</entry>
</row><row><entry><para>Bootroot build area</para>
</entry><entry><para>The fourth argument is the boot root build area, where the boot root
files are gathered.  See the following example from the <literal>bootroot_archive.py</literal> module. The module references the boot root build area in order to size
the boot root before creating the archive.</para><screen remap="">BR_BUILD = sys.argv[4]          # Bootroot build area

print "Sizing bootroot requirements..."
cmd = /usr/bin/du + " -sk " + BR_BUILD + " | " + /usr/bin/awk + " '{print $1}'"
bootroot_size = int(Popen(cmd, shell=True,
   stdout=PIPE).communicate()[0].strip()) </screen>
</entry>
</row><row><entry><para>Media area</para>
</entry><entry><para>The fifth argument specifies where the finished media is deposited.
 In the following example, the <filename>create_iso</filename> script uses
this argument to place the resultant ISO image.</para><screen remap="">MEDIA_DIR=$5
...
DIST_ISO=${MEDIA_DIR}/${DISTRO_NAME}.iso
... </screen>
</entry>
</row><row><entry><para>Additional arguments</para>
</entry><entry><para>A list of additional arguments to be passed into a script is tagged
in the manifest with the <filename>&lt;argslist&gt;</filename> tag. The first
of these arguments is  passed in as <command>arg6</command>.</para><para>In the following example from the <filename>slim_cd.xml</filename> manifest
file, two additional arguments are passed to the <filename>bootroot_configure</filename> script, as <literal>arg6</literal> and <literal>arg7</literal>:</para><screen remap="">&lt;argslist&gt;
     "/usr/share/distro_const/slim_cd/slimcd_generic_live.xml"
     ".livecd"
&lt;/argslist&gt;</screen><para>Another method for specifying additional arguments is to use key-value
pairs. See the following section.</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect3><sect3 id="manifestreader"><title>Using the <filename>ManifestReader</filename></title><para>The distribution constructor passes the manifest reader socket argument
into finalizer scripts. This argument specifies the socket that is used with <literal>/usr/bin/ManifestRead</literal> for accessing the manifest data.</para><para>The following example calls <filename>ManifestRead</filename> to request
the <filename>name</filename> item from the manifest file. <filename>ManifestRead</filename> returns zero or more items, each on its own line.  If <filename>ManifestRead</filename> is given multiple items to search for, the lines returned contain both the
item being searched for and a result.</para><screen>MFEST_SOCKET=$1

VOLNAME=`/usr/bin/ManifestRead ${MFEST_SOCKET} "name"`
if [ "XX${VOLNAME}" == "XX" ] ; then
       print -u2 "$0: Error retrieving volume ID"
       exit 1
fi</screen><para>The following example shows how to make use of <filename>ManifestRead</filename> from a python script:</para><screen>from <filename>osol_install.ManifestRead</filename> import <filename>ManifestRead</filename>

# get the manifest reader object from the socket
manifest_reader_obj = ManifestRead(MFEST_SOCKET)

# get bootroot compression type

BR_COMPR_TYPE = get_manifest_value(manifest_reader_obj,
   "img_params/output_image/bootroot/compression/type")
if (BR_COMPR_TYPE == None):
       raise Exception, (sys.argv[0] +
           ": bootroot compression type missing from manifest")</screen><sect4 id="keyvalue"><title>Specifying Key-Value Pairs</title><para>Another method for passing arguments into scripts is to specify a key-value
pair. This method is useful for passing the same argument into multiple scripts
without duplication. A script can access a keyed value by specifying the key
to <literal>/usr/bin/ManifestRead</literal> from within the script. Provide
the server socket as the first argument and then provide the nodepaths to
the items whose values are needed, as in the following examples.</para><example><title>Shell Script</title><screen>...
  MFEST_SOCKET=$1
  ...
  /usr/bin/ManifestRead -k $MFEST_SOCKET iso_sort
  iso_sort_file=`/usr/bin/ManifestRead $MFEST_SOCKET iso_sort`</screen><para>The above example calls <literal>ManifestRead</literal> from a shell
script to get a keyed value as in this sample script.</para>
</example><example><title>Python Script</title><screen>from <filename>osol_install.ManifestRead</filename> import <filename>ManifestRead</filename>

...
  IS_KEY = True

  iso_sort_file = manifest_reader_obj.get_values("iso_sort", IS_KEY)
  fd = open(iso_sort_file,....)</screen><para>The above example calls <filename>ManifestRead</filename> from python
to get the same keyed value.</para>
</example>
</sect4>
</sect3>
</sect2><sect2><title>Examples of Custom Finalizer Scripts</title><para>The following examples illustrate some practical applications for custom
finalizer scripts.</para><sect3><title>Adding Packages</title><para>When putting together an image, you can experiment with how an image
works when packages are added or removed from a working set. This type of
experimentation is supported by the distribution constructor. Additional packages
can be added to the existing list in the <literal>package</literal> section
of a manifest file. And, packages that you want to remove can be added to
the <literal>post_install_remove_package</literal> section. After you made
your modifications to the manifest file to add or remove packages, you need
to restart the build process from the beginning, and re-download all the packages.
That can take time. You can do these modifications more rapidly by using finalizer
scripts.</para><para>The following custom script adds an IPS package to the image from an
alternate repository specified in the manifest file. The package is added
to the package image area. The name of the package to add is included in the
script. This example also demonstrates how to use the <literal>ManifestRead</literal> program to get values from the manifest file.</para><example><title>Script for Adding Packages</title><screen>#!/bin/ksh
#
#
# Args:
#
#   5 arguments are passed in by default from the DC.
#
#   MFEST_SOCKET: Socket needed to get manifest data via ManifestRead object
#   PKG_IMG_PATH: Package image area
#   TMP_DIR: Temporary directory 
#   BR_BUILD: Area where bootroot is put together (not used in this example)
#   MEDIA_DIR: Area where the media is put (not used)
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if [ "$#" != "5" ] ; then
        print -u2 "Usage: $0: Requires 5 args:"
        print -u2 "    Reader socket, pkg_image area, tmp dir,"

        print -u2 "    bootroot build area, media area"
        exit 1
fi

MFEST_SOCKET=$1

PKG_IMG_PATH=$2
if [ ! -d $PKG_IMG_PATH ] ; then
        print -u2 "$0: Image package area $PKG_IMG_PATH is not valid"
        exit 1
fi

PKGCMD="/bin/pkg"

#Hard code package to install
TEST_PKGS="SUNWcdrw"

#
# You would have specified the additional repository like this in the manifest
#
#                 
#   &lt;pkg_repo_addl_authority&gt;
#        &lt;main url="http://localhost:10000" authname="localtest"/&gt;
#   &lt;/pkg_repo_addl_authority&gt;

# Get the alternate repository URL from the manifest
add_url=/usr/bin/ManifestRead ${MFEST_SOCKET} \
"distro_constr_params/pkg_repo_addl_authority/main/url"

# Get the alternate repository authority from the manifest
add_auth=/usr/bin/ManifestRead ${MFEST_SOCKET} \
"distro_constr_params/pkg_repo_addl_authority/main/authname"

added_authority=0

#
# Check to see if authority is already set in the package image area
# if not, add it in
#
${PKGCMD} -R $PKG_IMG_PATH authority $add_auth &gt; /dev/null 2&gt;&amp; 1
if [ $? != 0 ] ; then
        ${PKGCMD} -R $PKG_IMG_PATH  set-authority -O ${add_url} ${add_auth}
        added_authority=1
fi

if [$? != "0" ] ; then
        print -u2 "$0: Unable to set additional authority"
        exit 1
fi

for t in ${TEST_PKGS} ; do
        pkg_name="pkg://${add_auth}/${t}"
        ${PKGCMD} -R $PKG_IMG_PATH install ${pkg_name}
        if [$? != "0" ] ; then
                print -u2 "$0: Unable to install ${pkg_name}"

                exit 1
        fi
done

# if we have added the additional authority, unset it so it doesn't pollute what's
# originally there
if [ $added_authority == 1 ] ; then
         ${PKGCMD} -R $PKG_IMG_PATH  unset-authority ${add_auth}
fi

return 0</screen><para>Because this type of finalizer script adds or removes packages from
the package image area, you must reference the script as the first finalizer
script in the <literal>&lt;finalizer&gt;</literal> section of the manifest file.
Include in this reference a checkpoint name that indicates the point in the
image-building process where you want to restart the build to test your added
package.</para><para>For example, if you have created a script, <filename>export/home/user1/test_my_pkg</filename>, to test your custom package, you would reference the script as follows
in the finalizer section of the manifest file. Note that a checkpoint, named &ldquo;my_test,&rdquo;
indicates where the build will restart.</para><screen>&lt;finalizer&gt;
      &lt;script name="/export/home/user1/test_my_pkg"&gt;
           &lt;checkpoint name="my_test" message="Running my test package"
      &lt;/script&gt;
      &lt;script name="/usr/share/distro_const/pre_bootroot_pkg_image_mod"&gt;
           &lt;checkpoint name="im-mod" message="Image area modifications"/&gt;
      &lt;/script&gt;
      ........
&lt;/finalizer&gt;</screen><para>After you made the changes to the manifest file to reference your new
script, you can start building your image from the beginning once. After that,
if you make any changes to your package, you do not need to restart from the
beginning . You can generate an image with your modified package by starting
at the checkpoint that runs your script.</para><para>The following are the sequence of commands a user would execute to repeatedly
test their modifications to packages.</para><orderedlist><listitem><para>Run the build from the beginning after modifying the manifest.
Do this only once.</para><screen><command>distro_const build <replaceable>/my_updated_manifest.xml</replaceable></command></screen>
</listitem><listitem><para>Check steps that are resumable.</para><screen><command>distro_const build <option>l</option> <replaceable>/my_updated_manifest.xml</replaceable></command></screen>
</listitem><listitem><para>Restart from the step of your package modification. You can
restart from this step as many times as you need while you debugging your
modified contents.</para><screen><command>distro_const build <option>r</option> <replaceable>my_test /my_updated_manifest.xml</replaceable></command></screen>
</listitem>
</orderedlist><para>For further information about using the <command>distro_const</command> command with checkpointing options, as demonstrated in this example, see <olink targetptr="checkpoint" remap="internal"></olink>.</para>
</example>
</sect3><sect3><title>Testing Packages</title><para>When a particular package is specified in the <literal>package</literal> section of a manifest file, that package is installed in the package image
area by the distribution constructor. If you have an alternate version of
this package, such as your own private copy of a package, you could test this
version of the package by using a custom finalizer script. The finalizer script
would replace the previously installed version of the package with a test
version from an alternate repository.</para><para>In the following custom script, an IPS repository server is running
on <literal>http://localhost:10000</literal>. The name of the package to replace
is passed as an argument. The script first uninstalls the existing version
of the package, then installs the test version from the alternate repository.
This custom script also demonstrates how to get arguments passed in as finalizer
script arguments. Note the comments in the script that explain how the script
accomplishes these tasks.</para><example><title>Script for Testing an Alternate Package</title><screen>#!/bin/ksh
#
#
# Args:
#
#   These Arguments are passed in by default from the DC.
#
#   MFEST_SOCKET: Socket needed to get manifest data via ManifestRead object \
# (not used in this example)
#   PKG_IMG_PATH: Package image area
#   TMP_DIR: Temporary directory
#   BR_BUILD: Area where bootroot is put together (not used in this example)
#   MEDIA_DIR: Area where the media is put (not used)
#   PKG_NAMES: Package to replace with one from the test repo. 
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if [ "$#" != "6" ] ; then
        print -u2 "Usage: $0: Requires 6 args:"

        print -u2 "    Reader socket, pkg_image area, tmp dir,"
        print -u2 "    bootroot build area, media area, pkg_name"
        exit 1
fi


PKG_IMG_PATH=$2
if [ ! -d $PKG_IMG_PATH ] ; then
        print -u2 "$0: Image package area $PKG_IMG_PATH is not valid"
        exit 1
fi

PKGCMD="/bin/pkg"

#The test packages are passed in as arguments to this finalizer script
#You would have specified the argument like this in the finalizer section
#to pass in the argument
#
#
#  &lt;finalizer&gt;
#       &lt;script name="/my/update_my_pkg_test"&gt;
#               &lt;checkpoint name="update-pkg" message= \
"Replaces an existing package with my own"/&gt;
#                    &lt;argslist&gt;

#                       "SUNWcdrw"
#                    &lt;/argslist&gt;
#        &lt;/script&gt;
#  &lt;/finalizer&gt;
#
TEST_PKG=$6

#hard code alternate repository and authority.  Assume that my test package resides in
#a repository running on port 10000 of the localhost.

# Get the alternate repository URL from the manifest
add_url="http://localhost:10000"

# Get the alternate repository authority from the manifest
add_auth="MY_TEST"

added_authority=0

# Check to see if authority is already set in the package image area, if not,
# add it in
${PKGCMD} -R $PKG_IMG_PATH authority $add_auth &gt; /dev/null 2&gt;&amp; 1
if [ $? != 0 ] ; then
        ${PKGCMD} -R $PKG_IMG_PATH  set-authority -O ${add_url} ${add_auth}
        added_authority=1
fi


if [$? != "0" ] ; then
        print -u2 "$0: Unable to set additional authority"
        exit 1
fi

# Remove the package that's currently in the package image area.
${PKGCMD} -R $PKG_IMG_PATH uninstall ${TEST_PKG}
if [$? != "0" ] ; then
        print -u2 "$0: Unable to uninstall ${TEST_PKG}"
        exit 1
fi

# Install the package from test repo
pkg_name="pkg://${add_auth}/${TEST_PKG}"

${PKGCMD} -R $PKG_IMG_PATH install ${pkg_name}
if [$? != "0" ] ; then
        print -u2 "$0: Unable to install ${pkg_name}"
        exit 1
fi

# if we have added the additional authority, unset it so it doesn't pollute what's
# originally there
if [ $added_authority == 1 ] ; then
         ${PKGCMD} -R $PKG_IMG_PATH  unset-authority ${add_auth}
fi

return 0</screen>
</example>
</sect3><sect3><title>Adding a SVR4 Package</title><para>If you have a package that is in SVR4 format, you can test that package
in an image before you convert it into an IPS package. You can use a finalizer
script to add the content of a SVR4 package to the image. See the following
custom script and note the comments in the script that explain how the script
accomplishes this task.</para><example><title>Script for Adding a SVR4 Package</title><screen>#!/bin/ksh
#
#
# Args:
#
#   5 arguments are passed in by default from the DC.
#
#   MFEST_SOCKET: Socket needed to get manifest data via ManifestRead object (not used)
#   PKG_IMG_PATH: Package image area
#   TMP_DIR: Temporary directory
#   BR_BUILD: Area where bootroot is put together (not used in this example)
#   MEDIA_DIR: Area where the media is put (not used)
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if [ "$#" != "5" ] ; then
        print -u2 "Usage: $0: Requires 5 args:"

        print -u2 "    Reader socket, pkg_image area, tmp dir,"
        print -u2 "    bootroot build area, media area, pkg_name"
        exit 1
fi

PKG_IMG_PATH=$2
if [ ! -d $PKG_IMG_PATH ] ; then
        print -u2 "$0: Image package area $PKG_IMG_PATH is not valid"
        exit 1
fi

TMP_DIR=$3

#
# Install a SVR4 packages into the package image area
#

#create an admin file for non-interactive pkgadd's

ADMIN_FILE=${TMP_DIR}/admin.$$
cat &lt;&lt; \ADMIN_EOF &gt; $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

#
# Path to your new packages
#
PKG_PATH=/path/to/my/test/svr4_pkg

#
# Test package name 
#
SVR4_TEST_PKG=SUNWmy-test

/usr/sbin/pkgadd -n -a ${ADMIN_FILE} -d $PKG_PATH -R ${PKG_IMG_PATH} ${SVR4_TEST_PKG}

if [ $? != "0" ] ; then
        echo "installing package failed"

        exit 1
fi

/bin/rm ${ADMIN_FILE}

return 0</screen>
</example>
</sect3>
</sect2>
</sect1><sect1 id="distro_const"><title>Creating an Image</title><para>After you have set up the manifest file that you plan to use and customized
the finalizer scripts if desired, you are ready to build an image by running
the <command>distro_const</command> command.</para><para>The full syntax for this command is as follows:</para><screen>Syntax: <command>distro_const build [<option>R</option>] [<option>r</option> <replaceable>step</replaceable>] [<option>p</option> <replaceable>step</replaceable>] [<option>l</option>] <replaceable>manifest</replaceable></command></screen><note><para>You need to run the <command>distro_const</command> command as
root.</para>
</note><itemizedlist><para>You can use the <command>distro_const</command> command to do either
of the following:</para><listitem><para>Build an image in one step.</para>
</listitem><listitem><para>Build an image, but pause and restart the build as needed
in order to examine the content of the image and debug the finalizer scripts
during the build process.</para>
</listitem>
</itemizedlist><sect2><title>Creating an Image in One Step</title><para>To run a complete build of an image without pausing, use the basic <command>distro_const</command> command without options as follows:</para><screen># <command>distro_const build <replaceable>manifest</replaceable></command></screen><para>Replace <replaceable>manifest</replaceable> with the name of the manifest
file to be used as the blueprint for your image. The <command>build</command> subcommand is required. When you enter this command, the distribution constructor
pulls the needed packages for the image and builds the image to the specifications
that you entered in the manifest file.</para>
</sect2><sect2 id="checkpoint"><title>Using Checkpointing to Create an Image</title><para>You do not need to build an image without pausing. In fact, you may
prefer to pause and restart the build process to debug your  selection of
files, packages, and scripts for creating an image. You can use the checkpointing
options in the <command>distro_const</command> command to pause and restart
the build process as needed.</para><note><para>The checkpointing feature is enabled by default in a manifest
file. However, checkpointing can only function when you specify ZFS dataset,
or a mount point that correlates to a ZFS dataset , as your build area.</para><para>You can disable checkpointing in the manifest file by setting the <filename>checkpoint_enable</filename> parameter to <literal>false</literal>.</para>
</note><para>Use the checkpointing options that are available in the <command>distro_const</command> command as described in the following basic instructions.</para><note><para>For a summary of the options that are available for the <command>distro_const</command> command, see <olink type="auto-generated" targetptr="command" remap="internal"><command>distro_const</command> Command Reference</olink>.</para>
</note><task id="checkpointtask"><title>Creating an Image Using Checkpoint Options</title><procedure><step><para>Before you build the image, check the valid steps at which you
can choose to pause or resume the build by using the following command:</para><screen># <command>distro_const build [<option>l</option>] <replaceable>manifest</replaceable></command></screen><para>This command displays the valid steps at which you can pause or resume
building an image. Use the step names provided by this command as valid values
for the other checkpointing command options.</para><note><para>The <command>build</command> subcommand is required.</para>
</note><para>For example, the following command confirms which checkpoints are available,
given a manifest file named <replaceable>slim_cd_x86.xml</replaceable>.</para><screen># <command>distro_const build <option>l</option> <replaceable>slim_cd_x86.xml</replaceable></command></screen><para>After the command is run, the valid checkpointing steps are displayed
as follows.</para><screen>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-boot-root image area modifications
grub-setup         X     Grub menu setup
post-mod           X     Post bootroot image area modification
gen-slim-cont      X     Generate Slim CD image content list
iso                X     ISO image creation </screen><note><para>The check in the resumable field indicates that you can restart
the build from this step.</para>
</note>
</step><step><para>Use the following command to build an image, and to pause building
the image at the specified step.</para><screen># <command>distro_const build [<option>p</option> <replaceable>step</replaceable>] <replaceable>manifest</replaceable></command></screen><note><para>The <command>build</command> subcommand is required. The <replaceable>step</replaceable> and <replaceable>manifest</replaceable> fields are required.</para>
</note><para>For example, the following command starts building an image and pauses
the build before step <replaceable>im-mod</replaceable> modifies the image
area:</para><screen># <command>distro_const build <option>p</option> <replaceable>im-mod</replaceable> <replaceable>slim_cd_x86.xml</replaceable></command></screen>
</step><step><para>Resume the build, either from the last step executed or from a
specified step, by using one of the following alternatives:</para><stepalternatives><step><para>Use the following command to resume building the image from a
specified step.</para><screen># <command>distro_const build [<option>r</option> <replaceable>step</replaceable>] <replaceable>manifest</replaceable></command></screen><note><para>The specified step must be either the step at which the previous
build stopped executing, or an earlier step. A later step is not valid. The <replaceable>step</replaceable> and <replaceable>manifest</replaceable> fields are required.
The <command>build</command> subcommand is required.</para>
</note><para>For example, the following command resumes building the image where
the <replaceable>im-mod</replaceable> modifies the image area:</para><screen># <command>distro_const build <option>r</option> <replaceable>im-mod</replaceable> <replaceable>slim_cd_x86.xml</replaceable></command></screen>
</step><step><para>Use the following command to resume building the image from the
last step executed.</para><note><para>The <replaceable>manifest</replaceable> field and the <command>build</command> subcommand are required.</para>
</note><screen># <command>distro_const build [<option>R</option>] <replaceable>manifest</replaceable></command></screen><para>For example, the following command resumes building the image from wherever
the build had paused.</para><screen># <command>distro_const build <option>R</option> <replaceable>slim_cd_x86.xml</replaceable></command></screen>
</step>
</stepalternatives>
</step>
</procedure>
</task>
</sect2>
</sect1><sect1 id="command"><title><command>distro_const</command> Command Reference</title><para>The following table summarizes the <command>distro_const</command> command
options.</para><table frame="topbot" pgwide="1" id="pkgtbl"><title><command>distro_const</command> Command</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="33.05*"/><colspec colwidth="66.95*"/><thead><row rowsep="1"><entry><para>Command Options</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><command>distro_const build <replaceable>manifest</replaceable></command></para>
</entry><entry><para>Creates a full image, using the specified manifest file as the blueprint
for that image. The subcommand <command>build</command> is required. The <replaceable>manifest</replaceable> field is required.</para>
</entry>
</row><row><entry><para><command>distro_const build [<option>l</option>] <replaceable>manifest</replaceable></command></para>
</entry><entry><para>Lists valid steps at which the user can choose to pause or resume building
an image if checkpointing is active. This command option queries the manifest
file for valid steps. Use the step names provided by this command as valid
values for the other checkpointing command options. The <command>build</command> subcommand is required. The <replaceable>manifest</replaceable> field is
required.</para><note><para>Checkpointing is active by default, but requires ZFS filesystems.</para><para>Step values other than the first value correspond to finalizer script
entries in the manifest file.</para>
</note><itemizedlist><para>For example, the manifest, <filename>slim_cd/all_lang_slim_cd_x86.xml</filename>, includes the following steps:</para><listitem><para><literal>im-pop</literal> &ndash; Populate the image with
packages</para>
</listitem><listitem><para><literal>im-mod</literal> &ndash; Image area modifications</para>
</listitem><listitem><para><literal>slim-im-mod</literal> &ndash; Slim CD image area
modifications</para>
</listitem><listitem><para><literal>br-init</literal> &ndash; Boot-root initialization</para>
</listitem><listitem><para><literal>slim-br-config</literal> &ndash; Slim CD boot-root
configuration</para>
</listitem><listitem><para><literal>br-config</literal> &ndash; Boot-root configuration</para>
</listitem><listitem><para><literal>br-arch</literal> &ndash; Boot-root archiving</para>
</listitem><listitem><para><literal>slim-post-mod</literal> &ndash; Slim CD post-boot-root
image area modifications</para>
</listitem><listitem><para><literal>grub-setup</literal> &ndash; GRUB menu setup</para>
</listitem><listitem><para><literal>post-mod</literal> &ndash;  Post-boot-root image
area modification</para>
</listitem><listitem><para><literal>gen-slim-cont</literal> &ndash;  Generate Slim CD
image content list </para>
</listitem><listitem><para><literal>iso</literal> &ndash;  ISO image creation</para>
</listitem>
</itemizedlist><para>When additional scripts are added, additional default checkpoint steps
are added in the manifest file.</para><note><para>You can edit the checkpoint step names in the manifest file. Use
meaningful names for custom checkpoint steps in the manifest file instead
of using step numbers. If new scripts are added, the new steps for those new
scripts will disrupt a prior numbered step order.</para><para>For example,
the following reference in a manifest file specifies the checkpoint name of &ldquo;br-arch&rdquo;
for a boot root archiving script:</para><screen><literal>&lt;script name="/usr/share/distro_const/bootroot_archive.py"&gt;</literal>
<literal>&lt;checkpoint name="br-arch" message="Boot root archiving"/&gt;</literal></screen><para>In this example, when you build your image, you could refer to the &ldquo;br-arch&rdquo;
checkpoint in the <command>distro_const</command> command. This checkpoint
would enable you to pause building the image just before the boot root archiving
script performs its task.</para>
</note>
</entry>
</row><row><entry><para><command>distro_const build [<option>p</option> <replaceable>step</replaceable>] <replaceable>manifest</replaceable></command></para>
</entry><entry><para>Builds an image and pauses building the image at the specified step
if checkpointing is active. The <replaceable>step</replaceable> and <replaceable>manifest</replaceable> fields are required. The <command>build</command> subcommand
is required.</para>
</entry>
</row><row><entry><para><command>distro_const build [<option>r</option> <replaceable>step</replaceable>] <replaceable>manifest</replaceable></command></para>
</entry><entry><para>Resumes building the image from the specified step if checkpointing
is active. The specified step must be either the step at which the previous
build stopped executing, or an earlier step. A later step is not valid. The <replaceable>step</replaceable> and <replaceable>manifest</replaceable> fields are required.
The <command>build</command> subcommand is required.</para>
</entry>
</row><row><entry><para><command>distro_const build [<option>R</option>] <replaceable>manifest</replaceable></command></para>
</entry><entry><para>Resumes building the image from the last step executed if checkpointing
is active. The <replaceable>manifest</replaceable> field is required. The <command>build</command> subcommand is required.</para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>See also the <citerefentry><refentrytitle>distro_const</refentrytitle><manvolnum>1M</manvolnum></citerefentry> man page.</para>
</sect1><sect1 id="trouble"><title>Troubleshooting</title><para>Review the following troubleshooting items and see the latest information
at <ulink url="http://wikis.sun.com/display/OSOLInstall/Common+Questions+and+Trouble+Shooting" type="text">Installer Common Questions and Troubleshooting</ulink>.</para><sect2 id="errors"><title>I Get Error Messages When I Download a Package</title><para>Make sure the <command>pkg(1)</command> command on your system is working
correctly, and your connection with the IPS server is stable. Sometimes, IPS
times out when trying to download a big cluster of packages. To check outside
of the distribution constructor environment, try to mimic what the constructor
does in terms of installing packages. Try the following commands as root,
and make sure they work correctly.</para><screen width="1"><command>pkg image-create <option>F</option> <option>a</option> <replaceable>opensolaris.org=http://pkg.opensolaris.org</replaceable> <replaceable>/tmp/test_img</replaceable></command>
<command>pkg <option>R</option> <replaceable>/tmp/test_img install SUNWcsd</replaceable></command>
<command>pkg <option>R</option> <replaceable>/tmp/test_ima</replaceable> <replaceable>install</replaceable> <replaceable>SUNWcs</replaceable></command>
<command>pkg <option>R</option> <replaceable>/tmp/test_img</replaceable> <replaceable>install</replaceable> <replaceable>slim_install</replaceable></command></screen>
</sect2><sect2 id="manerr"><title>How to Debug Manifests With Validation Errors</title><para>If a manifest does not validate, as could be the case after the manifest
has been changed, run the <literal>ManifestServ</literal> utility in a verbose
mode to find the error.</para><para>The <command>ManifestServ</command> utility, <literal>/usr/bin/ManifestServ</literal>, with no arguments displays the following usage:</para><screen width="1">ManifestServ  
Usage: /bin/ManifestServ [-d] [-h|-?] [-s] [-t] [-v] [-f &lt;validation_file_base&gt; ] 
    [-o &lt;out_manifest.xml file&gt; ] &lt;manifest.xml file&gt; 
where: 
  -d: turn on socket debug output (valid when -s also specified) 
  -f &lt;validation_file_base&gt;: give basename for schema and defval files 
      Defaults to basename of manifest (name less .xml suffix) when not provided 
  -h or -?: print this message 
  -o &lt;out_manifest.xml file&gt;: write resulting XML after defaults and 
      validation processing 
  -t: save temporary file 
      Temp file is "/tmp/&lt;manifest_basename&gt;_temp_&lt;pid&gt; 
  -v: verbose defaults/validation output 
  -s: start socket server for use by ManifestRead </screen><para>The distribution constructor validates the manifest against an XML schema
and a <literal>defval</literal> manifest.  <command>ManifestServ</command> enables you to perform a manual validation, using a verbose mode which shows
where any problems are.</para><example id="mantbl2"><title>Debugging Schema Validation Errors</title><para>The following example demonstrates a case where the manifest didn't
validate against the schema.  The boldface message below indicates this is
a schema validation error.</para><screen width="1"># distro_const build my_distro.xml 
/usr/share/distro_const/DC-manifest.defval.xml validates 
/tmp/all_lang_slim_cd_x86_temp_7861.xml:350: element pair: 
Relax-NG validity error : Element pair failed to validate attributes 
/tmp/my_distro_temp_7861.xml fails to validate 
validate_vs_schema: Validator terminated with status 3 
validate_vs_schema: Validator terminated abnormally 
<emphasis role="strong">Error validating manifest against schema /usr/share/distro_const/DC-manifest.rng </emphasis>
# </screen><para>Run <command>ManifestServ</command>, <filename>/usr/bin/ManifestServ</filename>, specifying the <option>t</option> option, in order to save the temporary
file, and the <option>v</option> option, in order to provide verbose output
which will have the line number of the error.</para><screen width="1">$ <command>ManifestServ <option>f</option> <replaceable>/usr/share/distro_const/DC-manifest</replaceable> <option>t</option> <option>v</option> <replaceable>manifest_file</replaceable></command></screen><screen width="1">ManifestServ -f /usr/share/distro_const/DC-manifest -t -v my_distro.xml 
/usr/share/distro_const/DC-manifest.defval.xml validates 
Checking defaults for name 
Checking defaults for distro_constr_params/distro_constr_flags/stop_on_error 
Checking defaults for distro_constr_params/pkg_repo_default_authority/main/url 
...
...
(omitted content)
...
...
<emphasis role="strong">/tmp/my_distro_temp_7870.xml:350: element pair: Relax-NG validity error</emphasis>
<emphasis role="strong">: Element pair failed to validate attributes </emphasis>
/tmp/all_lang_slim_cd_x86_temp_7870.xml fails to validate 
validate_vs_schema: Validator terminated with status 3 
validate_vs_schema: Validator terminated abnormally 
Error validating manifest against schema /usr/share/distro_const/DC-manifest.rng 
Error running Manifest Server 
schema_validate: Schema validation failed for DC manifest /tmp/my_distro_temp_7870.xml </screen><para>The temporary file will be named near the end of the output.  In the
example above, the file is <filename>/tmp/my_distro_temp_7870.xml</filename>.  Per the bold error messages, open that file and go to line 350 to find
the issue. In this example, the line 350 looks like this:</para><screen width="1">&lt;key_value_pairs&gt; 
    &lt;pair value='/usr/share/distro_const/slim_cd/slimcd_iso.sort' key='iso_sort'/&gt; 
    <emphasis role="strong">&lt;pair VaLuE='myvalue' key='mykey'/&gt;</emphasis>
&lt;/key_value_pairs&gt;</screen><para>The attribute, <literal>VaLuE</literal>, is incorrect. This contrived
example should have <literal>value</literal> in all lowercase letters, as
shown the line immediately above that one. The second to last message line
states that the schema validation fails.  The schema used for validation for
the distribution constructor is <filename>/usr/share/distro_const/DC-manifest.xml</filename>.  The schema shows that the only attributes for <literal>&lt;pair&gt;</literal> are <literal>&lt;value&gt;</literal> and <literal>&lt;key&gt;</literal>, not <literal>&lt;VaLuE&gt;</literal>.</para>
</example><sect3 id="mantbl3"><title>Debugging Semantic Validation Errors</title><para>Semantic validation is also done.  Semantic validation checks content
for &ldquo;meaning&rdquo; and context errors as opposed to checking only the
syntax.  For example, finalizer scripts listed in a manifest can be validated
to confirm that the scripts are executable files.</para><para>The following shows a case where the manifest failed semantic validation.</para><screen width="1"># distro_const build -l my_distro_sem.xml 
/usr/share/distro_const/DC-manifest.defval.xml validates 
/usr/share/distro_const/grub_setup.py either doesn't exist 
or is not an executable file 
validate_node: Content "/usr/share/distro_const/grub_setup.py" 
at img_params/output_image/finalizer/script/name did not validate 
Error validating manifest tree content </screen><para>Semantic validation employs functions to do the validation, and those
functions print error messages explaining why the manifest failed validation.
 In this contrived case, the file <filename>/usr/share/distro_const/grub_setup.py</filename> is missing, and the error message points directly to the problem.  In this
case, either <filename>grub_setup.py</filename> needs to be restored, or,
if appropriate, the reference to that file needs to be removed from the manifest.</para><para>You can still run <command>ManifestServ</command> with <option>v</option> to get more details on  semantic validation, but this command option will
merely list the one failure among many successes, and may produce output which
is harder to read than when <option>v</option> is not specified.</para>
</sect3><sect3 id="mantbl4"><title>Checking Data</title><para>Once validation and other preprocessing is completed, <command>ManifestServ</command> prompts for data to dump and check. This step is more useful for testing
the data serving process rather than testing the data itself, since the data
is plainly visible in the manifest itself.</para><para>For more information about this interface, see the <literal>DC_DESIGN_DOC</literal> document in the caiman docs gate at <literal>ssh://anon@hg.opensolaris.org/hg/caiman/caiman-docs</literal>.</para>
</sect3>
</sect2>
</sect1><sect1 id="addl"><title>Additional Information</title><para>Additional information and resources about using the distribution constructor
are available at the following sites.</para><itemizedlist><listitem><para>For further troubleshooting help, see the Release Notes at <ulink url="http://www.opensolaris.com/use/" type="url"></ulink>.</para>
</listitem><listitem><para>Send questions or comments about the distribution constructor
application to <literal>caiman-discuss@opensolaris.org</literal>. Submit bugs
or enhancement requests to <ulink url="http://defect.opensolaris.org" type="url"></ulink>.</para>
</listitem>
</itemizedlist>
</sect1>
</chapter><chapter id="appendix"><title>Appendix: Sample Manifest File</title><highlights><para>The x86 Slim CD manifest file is shown below:</para>
</highlights><sect1 id="manifestfile"><title>Slim CD Manifest File</title><screen remap="wide">&lt;!--
    CDDL HEADER START

    The contents of this file are subject to the terms of the
    Common Development and Distribution License (the "License").
    You may not use this file except in compliance with the License.

    You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
    or http://www.opensolaris.org/os/licensing.
    See the License for the specific language governing permissions
    and limitations under the License.

    When distributing Covered Code, include this CDDL HEADER in each
    file and include the License file at usr/src/OPENSOLARIS.LICENSE.
    If applicable, add the following below this CDDL HEADER, with the
    fields enclosed by brackets "[]" replaced with your own identifying
    information: Portions Copyright [yyyy] [name of copyright owner]

    CDDL HEADER END

    Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
    Use is subject to license terms.

    XML specification for building the all languages OpenSolaris
    live CD iso and usb image
--&gt;

&lt;distribution name="OpenSolaris"&gt;
        &lt;distro_constr_params&gt;
                &lt;distro_constr_flags&gt;
                        &lt;!--
                             Controls whether the DC should stop
                             if there is an error when the DC is running
                        --&gt;
                        &lt;stop_on_error&gt;true&lt;/stop_on_error&gt;
                        &lt;!--
                             You can specify the step to resume the
                             build from here with the resume_from
                             attribute field of checkpoint_enable.
                             This value will be overridden by
                             the command line if the -r flag is used.
                             Valid values are step
                             numbers or name
                        --&gt;
                        &lt;checkpoint_enable&gt;
                                &lt;!--
                                     true implies Checkpointing is enabled
                                --&gt;
                                true
                        &lt;/checkpoint_enable&gt;
                &lt;/distro_constr_flags&gt;
                &lt;!--
                     The preferred authority to install packages into the
                     pkg_image area from.
                     The default url is: http://pkg.opensolaris.org/release
                     The default authname is opensolaris.org
                --&gt;
                &lt;pkg_repo_default_authority&gt;
                        &lt;main
                                url="http://pkg.opensolaris.org/release"
                                authname="opensolaris.org"/&gt;
                        &lt;!--
                             If you want to use one or more  mirrors that are
                             setup for the authority, specify the urls here.
                        --&gt;
                        &lt;!--
                             Uncomment before using
                        &lt;mirror url="" /&gt;
                        --&gt;
                &lt;/pkg_repo_default_authority&gt;
                &lt;!--
                     Any additional non-preferred authorities to pull packages
                     from should be specified here. Multiple additional
                     authorities may be specified.
                     If you want to use one or more  mirrors that are
                     setup for the authority, specify the urls here.
                --&gt;
                &lt;!--
                     Uncomment before using.
                &lt;pkg_repo_addl_authority&gt;
                        &lt;main
                                url=""
                                authname=""/&gt;
                        &lt;mirror url="" /&gt;
                &lt;/pkg_repo_addl_authority&gt;
                --&gt;
                &lt;!--
                     The default preferred authority to be used by the system
                     after it has been installed.
                     The default url is: http://pkg.opensolaris.org/release
                     The default authname is opensolaris.org
                     If you want to use one or more  mirrors that are
                     setup for the authority, specify the urls here.
                --&gt;
                &lt;post_install_repo_default_authority&gt;
                        &lt;main
                                url="http://pkg.opensolaris.org/release"
                                authname="opensolaris.org"/&gt;
                        &lt;!--
                             Uncomment before using.
                        &lt;mirror url="" /&gt;
                        --&gt;
                &lt;/post_install_repo_default_authority&gt;
                &lt;!--
                     Any additional non-preferred authorities to use after the
                     system has been installed. Multiple additional authorities
                     may be specified.
                     If you want to use one or more  mirrors that are
                     setup for the authority, specify the urls here.
                --&gt;
                &lt;!--
                     Uncomment before using.
                &lt;post_install_repo_addl_authority&gt;
                        &lt;main
                                url=""
                                authname=""/&gt;
                        &lt;mirror url="" /&gt;
                &lt;/post_install_repo_addl_authority&gt;
                --&gt;
        &lt;/distro_constr_params&gt;
        &lt;img_params&gt;
                &lt;!--
                     Where to build. This can be a zfs dataset or a mountpoint.
                     The area will be created if it doesn't exist. If the build_area
                     is not a zfs dataset or mountpoint, checkpointing will not
                     be enabled.
                --&gt;
                &lt;build_area&gt;rpool/dc&lt;/build_area&gt;
                &lt;!--
                     list of packages used to form the installed image
                --&gt;
                &lt;packages&gt;
                        &lt;!--
                             Due to dependency issues, SUNWcsd and SUNWcs
                             must be listed first in the package list,
                             and SUNWcsd must precede SUNWcs
                        --&gt;
                        &lt;!--
                            By default the latest build available, in the
                            specified IPS repository, is installed.
                            If another build is required, the build number has
                            to be appended to the 'entire' package in following
                            form:

                            &lt;pkg_name="entire@0.5.11-0.build#/&gt;
                        --&gt;
                        &lt;pkg name="entire"/&gt;
                        &lt;pkg name="SUNWcsd"/&gt;
                        &lt;pkg name="SUNWcs"/&gt;
                        &lt;pkg name="babel_install"/&gt;
                        &lt;pkg name="SUNWslim-utils"/&gt;
                &lt;/packages&gt;
&lt;!--
     Items below this line are rarely configured
--&gt;
                &lt;!--
                     Packages to be removed from the pkg_image area before
                     bootroot construction
                --&gt;
                &lt;post_install_remove_packages&gt;
                        &lt;!--
                            babel_install must be listed before slim_install
                            because babel_install depends on slim_install,
                            so, slim_install can't be uninstall first
                        --&gt;
                        &lt;pkg name="babel_install"/&gt;
                        &lt;pkg name="slim_install"/&gt;
                &lt;/post_install_remove_packages&gt;
                &lt;!--
                     If/how to compress the live image.
                     type = compression algorithm to use for pkg.zlib and misc.zlib.
                     Valid types are lzma, gzip, and none.
                --&gt;
                &lt;live_img_compression type="lzma"/&gt;
                &lt;!--
                     Grub menu modifications. Will use menu.lst if not specified
                --&gt;
                &lt;grub_menu_modifications&gt;
                        &lt;!--
                            Specify a title for the grub menu.
                            If a title for the grub menu is not specified,
                            the first line of /etc/release will be used as
                            the title for the grub menu
                        --&gt;
                        &lt;!--
                            Uncomment before using
                        &lt;title&gt;Special Grub Title Text&lt;/title&gt;
                        --&gt;
                        &lt;entry&gt;
                                &lt;title_suffix&gt;with magnifier&lt;/title_suffix&gt;
                                &lt;line&gt;kernel$ /platform/i86pc/kernel/$ISADIR/unix \
-B assistive_tech=magnifier&lt;/line&gt;
                                &lt;line&gt;module /boot/$ISADIR/x86.microroot&lt;/line&gt;
                        &lt;/entry&gt;

                       &lt;entry&gt;
                                &lt;title_suffix&gt;with screen reader&lt;/title_suffix&gt;
                                &lt;line&gt;kernel$ /platform/i86pc/kernel/$ISADIR/unix \
-B assistive_tech=reader&lt;/line&gt;
                                &lt;line&gt;module /boot/$ISADIR/x86.microroot&lt;/line&gt;
                        &lt;/entry&gt;
                        &lt;entry&gt;
                                &lt;title_suffix&gt;Enable SSH&lt;/title_suffix&gt;
                                &lt;line&gt;kernel$ /platform/i86pc/kernel/$ISADIR/unix -B livessh=enable&lt;/line&gt;
                                &lt;line&gt;module /boot/$ISADIR/x86.microroot&lt;/line&gt;
                        &lt;/entry&gt;
                &lt;/grub_menu_modifications&gt;
                &lt;!--
                     Indicate whether the IPS index should be generated for
                     pkg install and uninstall.  The default is to not
                     generate the IPS search index
                --&gt;
                &lt;generate_ips_search_index&gt;
                        false
                &lt;/generate_ips_search_index&gt;
                &lt;!--
                     Files and dirs to be included in the bootroot of all media
                     delivered by this distribution. Bootroot contains the
                     minimal list of contents in order to be able to
                     boot and setup a running system. These files and dirs
                     must exist in the pkg_image area.
                --&gt;
                &lt;bootroot_contents&gt;
                        &lt;base_include type="file"&gt;usr/sbin/pmadm&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/sbin/lofiadm&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/sbin/devfsadm&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/sbin/modload&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/sbin/i86/modload&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/sbin/mount&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/sbin/hostconfig&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/sbin/chroot&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/sbin/syslogd&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/coreadm&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/bash&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/ksh&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/cat&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/echo&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/false&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/grep&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/ls&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/rm&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/svcprop&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/true&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/cd&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/test&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/sleep&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/expr&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/fs/hsfs/fstyp&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/fs/hsfs/fstyp.so.1&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/fs/hsfs/mount&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/fs/ufs/fstyp&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/fs/ufs/fstyp.so.1&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/fs/ufs/mount&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/libfstyp.so.1&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/platexec&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/devfsadm/devfsadmd&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/libm.so.2&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/libm.so&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/libfstyp.so&lt;/base_include&gt;

                    &lt;base_include type="file"&gt;usr/lib/libz.so&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/libz.so.1&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/bin/i86/ksh93&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/isaexec&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/libast.so.1&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/libcmd.so.1&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/libdll.so.1&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/lib/libshell.so.1&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;usr/share/lib/xml/dtd/service_bundle.dtd.1&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/sadm/install/admin/default&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/sadm/system/admin/default_java&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/sadm/install/contents&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/adm/utmpx&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/adm/wtmpx&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/adm/aculog&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/lib/postrun/postrun-runq&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/lib/postrun/postrun&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/log/postrun.log&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/log/authlog&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/log/syslog&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/saf/zsmon/log&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/spool/cron/crontabs/adm&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/spool/cron/crontabs/root&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/nis/NIS+LDAPmapping.template&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/yp/aliases&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/yp/nicknames&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;kernel&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;boot&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;platform&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;system&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;lib&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;sbin&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;dev&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;devices&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;usr/lib/devfsadm/linkmod&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;root&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;jack&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;var/svc/manifest&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;var/svc/profile&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;var/pkg/catalog&lt;/base_include&gt;
                        &lt;base_include type="file"&gt;var/pkg/cfg_cache&lt;/base_include&gt;
                        &lt;base_include type="dir"&gt;etc&lt;/base_include&gt;
                        &lt;base_exclude type="dir"&gt;etc/gconf&lt;/base_exclude&gt;
                        &lt;base_exclude type="dir"&gt;etc/brltty&lt;/base_exclude&gt;
                        &lt;base_exclude type="dir"&gt;etc/gtk-2.0&lt;/base_exclude&gt;
                        &lt;base_exclude type="dir"&gt;etc/notices&lt;/base_exclude&gt;
                &lt;/bootroot_contents&gt;
                &lt;output_image&gt;
                        &lt;!--
                             List of finalizer scripts to be run. They are used
                             to customize the image and will be run in the
                             order listed. The name of the checkpoint to
                             be created when this script is run is required.
                             The checkpoint message is displayed when the
                             step is run and is optional.
                             There are 5 standard arguments that are passed to
                             every finalizer script (manifest socket, pkg_image path,
                             tmp dir, bootroot build area, media dir). You may also
                             specify additional arguments (arg6+) in the argslist.
                             This argslist is a whitespace-separated list of double
                             quoted strings.
                        --&gt;
                        &lt;finalizer&gt;
                                &lt;script name="/usr/share/distro_const/pre_bootroot_pkg_image_mod"&gt;
                                        &lt;checkpoint

                                               name="im-mod"
                                                message="Image area modifications"/&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/slim_cd/
                                slimcd_pre_bootroot_pkg_image_mod"&gt;
                                        &lt;checkpoint
                                                name="slim-im-mod"
                                                message="Slim CD Image area Modifications"/&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/bootroot_initialize.py"&gt;
                                        &lt;checkpoint
                                                name="br-init"
                                                message="Boot root initialization"/&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/slim_cd/slimcd_bootroot_configure"&gt;
                                        &lt;checkpoint
                                                name="slim-br-config"
                                                message="Slim CD boot root configuration"/&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/bootroot_configure"&gt;
                                        &lt;checkpoint
                                                name="br-config"
                                                message="Boot root configuration"/&gt;
                                        &lt;argslist&gt;
                                                "/usr/share/distro_const/slim_cd/slimcd_generic_live.xml"
                                                ".livecd"
                                        &lt;/argslist&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/bootroot_archive.py"&gt;
                                        &lt;checkpoint
                                                name="br-arch"
                                                message="Boot root archiving (64-bit)"/&gt;
                                        &lt;argslist&gt;"amd64"&lt;/argslist&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/bootroot_archive_32"&gt;
                                        &lt;checkpoint
                                                name="br-arch-32"
                                                message="Boot root archiving (32-bit)"/&gt;
                                        &lt;argslist&gt;"x86"&lt;/argslist&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/slim_cd/
                                 slimcd_post_bootroot_pkg_image_mod"&gt;
                                        &lt;checkpoint
                                                name="slim-post-mod"
                                                message="Slim CD post bootroot image area modification"/&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/grub_setup.py"&gt;
                                        &lt;checkpoint
                                                name="grub-setup"
                                                message="Grub menu setup"/&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/post_bootroot_pkg_image_mod"&gt;
                                        &lt;checkpoint
                                                name="post-mod"
                                                message="Post bootroot image area modification"/&gt;
                                        &lt;argslist&gt;
                                                "usr_zlib_compression=lzma"
                                        &lt;/argslist&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/slim_cd/slimcd_gen_cd_content"&gt;
                                        &lt;checkpoint
                                                name="gen-slim-cont"
                                                message="Generate Slim CD image content list"/&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/create_iso"&gt;
                                        &lt;checkpoint
                                               name="iso"
                                                message="ISO image creation"/&gt;
                                &lt;/script&gt;
                                &lt;script name="/usr/share/distro_const/create_usb"&gt;
                                        &lt;checkpoint
                                                name="usb"
                                                message="USB image creation"/&gt;
                                &lt;/script&gt;
                        &lt;/finalizer&gt;
                        &lt;bootroot&gt;
                                &lt;!--
                                     If/how to compress the bootroot. Valid
                                     types are gzip and none
                                --&gt;
                                &lt;compression type="gzip" level="9"/&gt;
                        &lt;/bootroot&gt;
                &lt;/output_image&gt;
        &lt;/img_params&gt;
        &lt;key_value_pairs&gt;
                &lt;pair key="iso_sort"
                    value="/usr/share/distro_const/slim_cd/slimcd_iso.sort"/&gt;
        &lt;/key_value_pairs&gt;
&lt;/distribution&gt;</screen>
</sect1>
</chapter>