usr/src/cmd/distro_const/DC-manifest.rng
author Karen Tung <Karen.Tung@Sun.COM>
Tue, 07 Apr 2009 14:41:26 -0700
changeset 517 90634384a309
parent 401 2f6d4bf63451
child 636 cac9378cd3f8
permissions -rw-r--r--
7751 AI image shows warning about /etc/system during boot 5416 GRUB shouldn't track nevada build numbers on official releases

<!--
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.
-->

<!--
===============================================================================
RelaxNG schema for Distribution Constructor input manifest specification.

Contains schema rules and content specification for DC input manifest.

				===Warning===
This file must be kept in sync with the defval-manifest.  When items are
added/removed to/from this schema, there may be changes to the list of items
requiring validation or defaults.
				===Warning===

===============================================================================
-->


<grammar
    xmlns="http://relaxng.org/ns/structure/1.0"
    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

	<!--
	=======================================================================
	Top o' the tree
	=======================================================================
	-->
	<start>
		<element name="distribution">
			<attribute name="name"/>

			<!-- General distro-constructor parameters -->
			<ref name="nm_distro_constr_params"/>

			<!-- Parameters for building live image portion -->
			<ref name="nm_img_params"/>

			<!-- General key-value pairs -->
			<ref name="nm_key_value_pairs"/>
		</element>
	</start>

	<!--
	=======================================================================
	Parameters dealing with how the distro-constructor works.
	=======================================================================
	-->
	<define name="nm_distro_constr_params">
		<element name="distro_constr_params">
		<interleave>	<!-- Any element order is OK. -->

			<!-- Flags controlling DC execution. -->
			<ref name="nm_distro_constr_flags"/>

			<!-- Main (default) repo (and it's mirrors) to get
			     packages for live image and optional on-board repo.
			     FMRIs without an explicit authority will be
			     sought-for here.  -->
			<element name="pkg_repo_default_authority">
				<ref name="nm_pkg_repo_contents"/>
			</element>

			<!-- Aliases for additional repos, where to find
			     packages not in main repo.  Packages using one of
			     these aliases must spell the alias out as part of
			     the package FMRI.  It is called an alias because it
			     instructs DC to search through a prefered repo
			     (same name as the alias itself) and then mirror
			     repos if necessary. -->
			<zeroOrMore>
				<element name="pkg_repo_addl_authority">
					<ref name="nm_pkg_repo_contents"/>
				</element>
			</zeroOrMore>

			<!-- The default repo (and it's mirrors) for the system
			    to use after the install has completed.  -->
			<optional>
				<element name="post_install_repo_default_authority">
					<ref name="nm_pkg_repo_contents"/>
				</element>
			</optional>

			<!-- Additional repos (and their mirrors) for the system
			    to use after the install has completed.  -->
			<zeroOrMore>
				<element name="post_install_repo_addl_authority">
					<ref name="nm_pkg_repo_contents"/>
				</element>
			</zeroOrMore>
		</interleave>
		</element>
	</define>

	<define name="nm_distro_constr_flags">
		<element name="distro_constr_flags">
		<interleave>

			<!-- Stop when an error is encountered, including in
			     scripts/functions/programs run by the finalizer.-->
			<optional>	<!-- Default is true. -->
				<element name="stop_on_error">
					<data type="boolean"/>
				</element>
			</optional>

			<!-- Enable checkpointing, or saving snapshots of the
			     pkg image area at various (but specified)
			     points -->
			<optional>	<!-- Default is true. -->
				<ref name="nm_checkpointing"/>
			</optional>

		</interleave>
		</element>
	</define>

	<define name="nm_checkpointing">
		<element name="checkpoint_enable">
			<data type="boolean"/>

			<!-- Which checkpt to resume from. -->
			<!-- Default is 0 (beginning)-->
			<optional>
				<attribute name= "resume_from">
					<text/>
				</attribute>
			</optional>
		</element>
	</define>

	<!--
	=======================================================================
	=======================================================================
	Definitions / specifications for the live image parameters.
	=======================================================================
	=======================================================================
	-->

	<!--
	=======================================================================
	"Top" section for live image parameters.  This section describes how to
	build the medium's bootable live image.
	=======================================================================
	-->
	<define name="nm_img_params">
		<element name="img_params">
		<interleave>

			<!-- List of packages from which live image is built.
			     Package name can the name of an IPS incorporation
			     if such incorporation is in the source repository.
			     Package attributes and file tags help refine what
			     will actually be included. -->
			<element name="packages">
				<oneOrMore>
					<ref name="nm_pkg"/>
				</oneOrMore>
			</element>

			<!-- List of packages to remove after all packages
			     specified in the "packages" section are
			     installed into the package image area.  
			     Package name can the name of an IPS incorporation
			     if such incorporation is in the source repository.
			     Package attributes and file tags help refine what
			     will actually be included. -->
			<optional>
				<element name="post_install_remove_packages">
					<oneOrMore>
						<ref name="nm_pkg"/>
					</oneOrMore>
				</element>
			</optional>

			<!-- Indicate whether the IPS index should be generated
			     for pkg install and uninstall.  The default
			     is to not generate the IPS search index -->
			<optional>	<!-- Default is false. -->
				<element name="generate_ips_search_index">
					<data type="boolean"/>
				</element>
			</optional>

			<!-- Files 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. -->
			<ref name="nm_bootroot_contents"/>

			<!-- If/how to compress live image. -->
                        <optional>
				<element name="live_img_compression">
                               		<ref name="nm_live_img_compression"/>
				</element>
                        </optional>

			<!-- Hostname -->
			<element name="hostname">
				<text/>
			</element>

			<!-- All things locale-specific. -->
			<optional>	<!-- Posix/C always there -->
				<ref name="nm_locale"/>
			</optional>

			<!-- Users -->
			<ref name="nm_root_user"/>
			<zeroOrMore>
				<ref name="nm_user"/>
			</zeroOrMore>

			<!-- grub menu modifications. -->
			<optional>	<!-- If not specified,
					     use regular menu.lst -->
				<ref name="nm_grub_menu_mods"/>
			</optional>

			<!-- SMF profile defining which net services get
			     started at boottime.  Note: Use one of
			     /var/svc/profile/generic_limited_net.xml or
			     /var/svc/profile/generic_open.xml which define the
			     two configurations delivered with Solaris, or use
			     your own. -->
			<optional> <!-- generic_limited_net.xml if not spec -->
				<element name="netservices_SMF_profile">
					<text/>	<!-- filepath -->
				</element>
			</optional>

			<!-- power management. -->
			<optional>	<!-- Default is disabled -->
				<ref name="nm_power_mgmt"/>
			</optional>

			<!-- Directory to build the pkg-image area in.
			     Will be created if it doesn't exist. -->
			<element name="build_area">
				<text/>	<!-- dirpath -->
			</element>

			<!-- Limit of how large the pkg image area can grow.
			     Zero is unlimited. -->
			<optional>
				<!-- Default is unlimited.  Units are GB -->
				<element name="pkg_image_area_max_size_gb">
					<data type="float"/>
				</element>
			</optional>

			<!--  Parameters specific to different output images -->
			<oneOrMore>
				<ref name="nm_output_image"/>
			</oneOrMore>
		</interleave>
		</element>
	</define>

	<!--
	=======================================================================
	Grub menu modifications
	=======================================================================
	-->
	<define name="nm_grub_menu_mods">
		<element name="grub_menu_modifications">
			<interleave>
				<optional>
					<element name="title">
						<text/>
					</element>
				</optional>
				<optional>
					<element name="default_entry">
						<data type="unsignedInt"/>
					</element>
				</optional>
				<optional>
					<element name="timeout">
						<data type="unsignedInt"/>
					</element>
				</optional>
				<zeroOrMore>
					<ref name="nm_grub_entry"/>
				</zeroOrMore>
			</interleave>
		</element>
	</define>

	<define name="nm_grub_entry">
		<element name="entry">
			<optional>
				<attribute name="position">
					<data type="unsignedInt"/>
				</attribute>
			</optional>
			<element name="title_suffix">
				<text/>
			</element>
			<oneOrMore>
				<element name="line">
					<text/>
				</element>
			</oneOrMore>
		</element>
	</define>

	<!--
	=======================================================================
	Bootroot content specification.  Start with a base list of files
	to put into the bootroot.  Then adjust this list by adding and deleting
	individual files as adjustments.

	Base list is not to be changed;  make changes through adjustments.
	This is to provide a better record of what changes are made for
	specific distibutions,which may be important for debugging purposes.
	GUIs should honor this and only add to the adjustments list.
	=======================================================================
	-->
	<define name="nm_bootroot_contents">
		<element name="bootroot_contents">
			<interleave>
				<oneOrMore>
					<ref name="nm_base_include"/>
				</oneOrMore>
				<zeroOrMore>
					<element name="base_exclude">
						<ref name="nm_excltype_attr"/>
						<text/>
					</element>
				</zeroOrMore>
				<zeroOrMore>
					<ref name="nm_adjustment"/>
				</zeroOrMore>
			</interleave>
		</element>
	</define>

	<!--
	Files to be included may be specified as individual files or as
	directories of files.  On some platforms per-file compression is done by
	default.  This can be disabled on individual files which are read in as
	part of a directory of files, by base_include'ing that file and
	specifying fiocompress="false" for it.
	-->

	<define name="nm_base_include">
		<element name="base_include">
			<choice>
				<!-- Can be either files or dirs,
					but files allow more attributes. -->
				<ref name="nm_inclfiletype_attr"/>
				<ref name="nm_incldirtype_attr"/>
			</choice>
			<text/>
		</element>
	</define>

	<define name="nm_inclfiletype_attr">
		<group>
			<!-- In the case of "type = file", allow fiocompress -->
			<attribute name="type">
				<choice>
					<value>file</value>
				</choice>
			</attribute>
			<optional>
				<attribute name="fiocompress">
					<data type="boolean"/>
				</attribute>
			</optional>
		</group>
	</define>

	<define name="nm_incldirtype_attr">
		<group>
			<attribute name="type">
				<choice>
					<value>dir</value>
				</choice>
			</attribute>
		</group>
	</define>

	<define name="nm_excltype_attr">
		<group>
			<attribute name="type">
				<choice>
					<value>file</value>
					<value>dir</value>
				</choice>
			</attribute>
		</group>
	</define>

	<!--
	=======================================================================
	Selections for live image compression parameters.  Includes type and
	level.  Keep separate from other sets of compression parameters to
	allow for other options available only to live images.
	=======================================================================
	-->
	<define name="nm_live_img_compression">
		<!-- enum of gzip, none -->
		<attribute name="type">
			<choice>
				<value>gzip</value>
				<value>lzma</value>
				<value>none</value>
			</choice>
		</attribute>
		<attribute name="level">
			<data type="unsignedByte"/>
		</attribute>
	</define>

	<!--
	=======================================================================
	Selections for bootroot compression parameters.  Includes type and
	level.  Keep separate from other sets of compression parameters to
	allow for other options available only to bootroots.
	=======================================================================
	-->
	<define name="nm_bootroot_compression">
		<!-- enum of gzip, none -->
		<attribute name="type">
			<choice>
				<value>gzip</value>
				<value>none</value>
			</choice>
		</attribute>
		<attribute name="level">
			<data type="unsignedByte"/>
		</attribute>
	</define>

	<!--
	=======================================================================
	Output image processing
	=======================================================================
	-->
	<define name="nm_output_image">
		<element name="output_image">
			<interleave>

				<!-- Tweeks to the bootroot specific for this
				     output image. -->
				<optional> <!-- Maybe generic broot is fine -->
					<ref name="nm_output_image_bootroot"/>
				</optional>

				<!-- Customization scripts to run to generate
				     this image. -->
				<element name="finalizer">
					<oneOrMore>
						<ref name=
						    "nm_finalizer_script"/>
					</oneOrMore>
				</element>
			</interleave>
		</element>
	</define>

	<!--
	=======================================================================
	Tweeks to the bootroot specific for this output image.
	=======================================================================
	-->
	<define name="nm_output_image_bootroot">
		<element name="bootroot">
			<interleave>

				<!-- Uncompressed bootroot is sized according
				     to its contents, plus padding as
				     given here. -->
				<optional>
					<element name="size_pad_mb">
						<data type= "unsignedInt"/>
					</element>
				</optional>

				<!-- If/how to compress bootroot -->
				<optional>
					<element name="compression">
      	                         		<ref name=
						    "nm_bootroot_compression"/>
					</element>
				</optional>

				<!-- Additional files to add or remove from this
				     image's bootroot. -->
				<zeroOrMore>
					<ref name= "nm_adjustment"/>
				</zeroOrMore>
			</interleave>
		</element>
	</define>

	<!--
	=======================================================================
	Specification of customization script with args
	=======================================================================
	-->
	<define name="nm_finalizer_script">
		<element name="script">

			<!-- Name of the script -->
			<attribute name="name">
				<text/>		<!-- filepath -->
			</attribute>

			<element name="checkpoint">
				<!-- Name of the checkpoint -->
				<attribute name="name">
					<text/>	<!-- name of chckpoint -->
				</attribute>

				<!-- checkpoint message to print out -->
				<optional>
					<attribute name="message">
						<text/>
					</attribute>
				</optional>
			</element>

			<!-- Args to pass to the script -->
			<optional>	<!-- Maybe none are needed -->
				<element name="argslist">
					<text/>
				</element>
			</optional>
		</element>
	</define>

	<!--
	=======================================================================
	Define an authority and its mirror backups.
	=======================================================================
	-->
	<define name="nm_pkg_repo_contents">
		<element name="main">
			<ref name="nm_auth_name"/>
		</element>
		<zeroOrMore>
			<element name="mirror">
				<ref name="nm_mirror_name"/>
			</element>
		</zeroOrMore>
	</define>

	<define name="nm_auth_name">
		<attribute name="authname">
			<text/>
		</attribute>
		<attribute name="url">
			<text/>
		</attribute>
	</define>

	<define name="nm_mirror_name">
		<attribute name="url">
			<text/>
		</attribute>
	</define>


	<!--
	=======================================================================
	Package elements which represent package specifications.  These include
	name and things to filter on.  Tags are per file filters.  Attributes
	are per-package filters.
	=======================================================================
	-->
	<define name="nm_pkg">
		<element name="pkg">
			<attribute name="name">
				<text/>
			</attribute>
			<optional>
				<attribute name="attrs">
					<!-- Addl checking needed -->
					<text/>
				</attribute>
			</optional>
			<optional>
				<attribute name="tags">
					<!-- Addl checking needed -->
					<text/>
				</attribute>
			</optional>
		</element>
	</define>

	<!--
	=======================================================================
	All things locale.  Includes a list of locales to support, plus defaults
	for locale and timezone.
	=======================================================================
	-->
	<define name="nm_locale">
		<element name="locale_list">
			<!-- Rather than a long list of elements, one per
			     locale, manifest will be easier to
			     read w/single element w/text list. -->
			<text/>
		</element>
		<optional>
			<element name="locale_defaults">
				<attribute name="locale">
					<text/>
				</attribute>
				<attribute name="timezone">
					<text/>
				</attribute>
			</element>
		</optional>
	</define>

	<!--
	=======================================================================
	Adjustments to bootroot file list.
	=======================================================================
	-->
	<define name="nm_adjustment">
		<element name="adjustment">
			<choice>
				<attribute name="add">
					<text/>
				</attribute>
				<attribute name="delete">
					<text/>
				</attribute>
			</choice>
		</element>
	</define>

	<!--
	=======================================================================
	Root user info.  Neither UID, GID nor username are available for setting
	Other user info is settable.
	=======================================================================
	-->
	<define name="nm_root_user">
		<element name="root_user">
			<ref name="nm_cmn_user_info"/>
		</element>
	</define>

	<!--
	=======================================================================
	Non-root user info.  Accepts UID, GID and usernale as well as other
	user info (comon with root) as settable.
	=======================================================================
	-->
	<define name="nm_user">
		<element name="user">
			<attribute name="username">
				<text/>
			</attribute>
			<attribute name="UID">
				<data type= "unsignedInt"/>
			</attribute>
			<attribute name="GID">
				<data type= "unsignedInt"/>
			</attribute>
			<ref name="nm_cmn_user_info"/>
		</element>
	</define>

	<!--
	=======================================================================
	Settable user info common to all users including root.
	=======================================================================
	-->
	<define name="nm_cmn_user_info">

		<!-- This user can be logged-into directly, as opposed to su
		     only. -->
		<optional>
			<!-- Default for root is true if no other accounts;
			     default for others is false -->
			<attribute name="directlogin">
				<data type="boolean"/>
			</attribute>
		</optional>

		<interleave>	<!-- Can interleave only elements, not attr -->

			<!-- Home directory. -->
			<optional>
				<!-- Default homedir:/export/home/<username> -->
				<element name="homedir">
					<text/>
				</element>
			</optional>

			<!-- Shell. -->
			<optional>
				<!-- Default shell to be /bin/ksh93 -->
				<element name="shell">
					<text/>
				</element>
			</optional>

			<!-- Password, and whether it is encrypted here.  -->
			<optional>
				<!-- Default is no password, not encrypted -->
				<element name="password">
					<attribute name="encrypted">
						<data type="boolean"/>
					</attribute>
					<text/>
				</element>
			</optional>

			<!-- Optional package containing account files to
			     populate home directory with. -->
			<optional>
				<element name="account_contents">
					<text/>
				</element>
			</optional>
		</interleave>
	</define>
 
	<!--
	=======================================================================
	Power management.  Right now, it can only be enabled/disabled.
	=======================================================================
	-->
	<define name="nm_power_mgmt">
		<element name="power_mgmt">
			<optional>
				<element name="enable">
					<optional>
						<data type="boolean"/>
					</optional>
				</element>
			</optional>
		</element>
	</define>

	<!--
	=======================================================================
	=======================================================================
	Definitions / specifications for key-value pairs.
	=======================================================================
	=======================================================================
	-->
	<define name="nm_key_value_pairs">
		<optional>
			<element name="key_value_pairs">
				<zeroOrMore>
					<element name="pair">
						<attribute name="key">
							<text/>
						</attribute>
						<attribute name="value">
							<text/>
						</attribute>
					</element>
				</zeroOrMore>
			</element>
		</optional>
	</define>
</grammar>