Solaris Advanced Installation Guide

Creating the rules File

What Is the rules File

The rules file is a text file that should contain a rule for each group of systems (or single systems) that you want to automatically install. Each rule distinguishes a group of systems based on one or more system attributes, and it links each group to a profile, which is a text file that defines how the Solaris software will be installed on each system in the group. For example, the rule

karch sun4c - basic_prof -

specifies that the Solaris installation program will automatically install any system with the sun4c platform group based on the information in the basic_prof profile. The rules file is used to create the rules.ok file, which is required for custom JumpStart installations.


Note -

If you set up the JumpStart directory by using the procedures on "Creating a Profile Diskette " or "Creating a Profile Server", an example rules file should already be in the JumpStart directory; the example rules file contains documentation and some example rules. If you use the example rules file, make sure you comment out the example rules that you will not use.


When Does a System Match a Rule

During a custom JumpStart installation, the Solaris installation program attempts to match the system being installed to the rules in the rules.ok file in order: first rule through the last rule. A rule match occurs when the system being installed matches all of the system attributes defined in the rule. As soon as a system matches a rule, the Solaris installation program stops reading the rules.ok file and begins to install the system based on the matched rule's profile.

Important Information About the rules File

The rules file must have:

The rules file allows:

How to Create the rules File

  1. Open a new text file (it must be named rules) using the editor of your choice.

    You can create a new rules file or edit the sample rules file provided in the JumpStart directory you created.

  2. Add a rule in the rules file for each group of systems you want to install using custom JumpStart.

    Refer to the following information as you add rules to the rules file:

    A rule within the rules file must have the following syntax:

    [!]rule_keyword rule_value [&& [!]rule_keyword rule_value]... begin  profile  finish
     
    

    !

    Is a symbol used before a rule keyword to indicate negation. 

    [ ]

    Is a symbol used to indicate an optional expression or field. 

    ...

    Is a symbol used to indicate the preceding expression may be repeated. 

    rule_keyword

    Is a predefined keyword that describes a general system attribute, such as host name (hostname) or memory size (memsize). It is used with the rule value to match a system with the same attribute to a profile. See Table 8-2 for the list of rule keywords.

    rule_value

    Is a value that provides the specific system attribute for the corresponding rule keyword. See Table 8-2 for the list of rule values.

    &&

    Is a symbol that must be used to join rule keyword and rule value pairs together in the same rule (a logical AND) . During a custom JumpStart installation, a system must match every pair in the rule before the rule matches. 

    begin

    Is a name of an optional Bourne shell script that can be executed before the installation begins. If no begin script exists, you must enter a minus sign (-) in this field. All begin scripts must reside in the JumpStart directory.

    See "Creating Begin Scripts" for detailed information on how to create begin scripts.

    profile

    Is a name of a text file that defines how the Solaris software will be installed on the system when a system matches the rule. The information in a profile consists of profile keywords and their corresponding profile values. All profiles must reside in the JumpStart directory. 


    Note -

    There are optional ways to use the profile field, which are described in "Using a Site-Specific Installation Program" and "Creating Derived Profiles With Begin Scripts".


    finish

    Is a name of an optional Bourne shell script that can be executed after the installation completes. If no finish script exists, you must enter a minus sign (-) in this field. All finish scripts must reside in the JumpStart directory.  

    See "Creating Finish Scripts" for detailed information on how to create finish scripts.

  3. Save the rules file into the JumpStart directory.

    The rules file should be owned by root and have permissions equal to 644.

Where to Go Next

This completes the procedure to create a rules file. To create profiles, go to "Creating a Profile".

Rule Examples

The following illustration shows several example rules in a rules file. Each line has a rule keyword and a valid value for that keyword. The Solaris installation program scans the rules file from top to bottom. When the Solaris installation program matches a rule keyword and value with a known system, it installs the Solaris software specified by the profile listed in the profile field.

	
#  rule keywords and rule values      begin script       profile       finish script
	#  -----------------------------      ------------       --------      -------------
 [This rule matches if the system's host name is eng-1. The basic_prof profile is used to install
the Solaris software on the system that matches this rule.]  hostname eng-1                        -               basic_prof          -
  [The rule matches if the system is on subnet 192.43.34.0
and it is not a SPARCstation IPX(TM) (SUNW,Sun
4_50). The net_prof profile is used to install
the
Solaris software on systems that match this rule. ]  network 192.43.34.0 && !model \
 'SUNW,Sun 4_50'                        -                net_prof            -
  [The rule matches if the system is a SPARCstation LX. The lx_prof profile and the complete finish script
are used to install the Solaris software on systems that match this rule.
This rule also provides an example of rule wrap, which is defined on "Important Information About the rules File".]  model SUNW,SPARCstation-LX            -                 lx_prof	         complete
  [This rule matches if the system is on subnet 193.144.2.0
and the system is an x86 system. The setup begin script,
the x86_prof profile, and the done finish
script are used to install the Solaris software on systems that match this
rule.]  network 193.144.2.0 && karch i86pc	  setup              x86_prof         done
  [This rule matches if the system has 16-32 Mbytes of memory
and its a
PowerPC. The prog_prof profile is used to install
the Solaris software on systems that match this rule.]  memsize 16-32 && arch ppc              -                prog_prof          -
  [This rule matches any system that did not match the previous
rules. The generic_prof profile is used to install the
Solaris software on systems that match this rule. If used, -any
should always be in the last rule.]  any  -                                 -                generic_prof        -

Rule Keyword and Rule Value Descriptions

Table 8-2 describes the rule keywords and rule values that you can use in the rules file.

Table 8-2 Rule Keyword and Rule Value Descriptions

Rule Keyword 

Rule Values 

Description 

any

minus sign (-)

Match always succeeds. 

arch

processor_type

The following table lists the valid values for processor_type.

platform          processor_type
SPARC          sparc
x86             i386

Matches a system's processor type. The uname -p command reports the system's processor type.

domainname

domain_name

Matches a system's domain name, which controls how a name service determines information.  

If you have a system already installed, the domainname command reports the system's domain name.

disksize

disk_name size_range

disk_name - A disk name in the form cxtydz, such as c0t3d0, or the special word rootdisk. If rootdisk is used, the disk to be matched is determined in the following order:

  • The disk that contains the pre-installed boot image (new SPARC based system with factory JumpStart installed)

  • The c0t3d0s0 disk, if it exists

  • The first available disk (searched in kernel probe order)

size_range - The size of the disk, which must be specified as a range of Mbytes (xx-xx).

Matches a system's disk (in Mbytes). 

Example: 


disksize c0t3d0 250-300

The example tries to match a system with a c0t3d0 disk that is between 250 and 300 Mbytes.


Note -

When calculating size_range, remember that a Mbyte equals 1,048,576 bytes. A disk may be advertised as a "535 Mbyte" disk, but it may have only 510 million bytes of disk space. The Solaris installation program will actually view the "535 Mbyte" disk as a 510 Mbyte disk because 535,000,000 / 1,048,576 = 510. So, a "535 Mbyte" disk would not match a size_range equal to 530-550.


hostaddress

IP_address

Matches a system's IP address. 

hostname

host_name

Matches a system's host name.  

If you have a system already installed, the uname -n command reports the system's host name.

installed

slice version

slice - A disk slice name in the form cwtxdysz, such as c0t3d0s5, or the special words any or rootdisk. If any is used, all of the system's disks will try to be matched (in kernel probe order). If rootdisk is used, the disk to be matched is determined in the following order:

  • The disk that contains the pre-installed boot image (new SPARC based system with factory JumpStart installed)

  • The c0t3d0s0 disk, if it exists

  • The first available disk (searched in kernel probe order)

version - A version name, Solaris_2.x, or the special words any or upgrade. If any is used, any Solaris or SunOS release is matched. If upgrade is used, any upgradable Solaris 2.1 or greater release is matched.

Matches a disk that has a root file system corresponding to a particular version of Solaris software. 

Example:  


installed c0t3d0s1 Solaris_2.5

The example tries to match a system that has a Solaris 2.5 root files system on c0t3d0s1.

karch

platform_group

Valid values are sun4d, sun4c, sun4m, sun4u, i86pc, or prep. (See Appendix C, Platform Names and Groups for a detailed list of systems and their corresponding platform group.)

Matches a system's platform group.  

If you have a system already installed, the arch -k command or the uname -m command reports the system's platform group.

memsize

physical_mem

The value must be a range of Mbytes (xx-xx) or a single Mbyte value.

Matches a system's physical memory size (in Mbytes).  

Example: 


memsize 16-32

The example tries to match a system with a physical memory size between 16 and 32 Mbytes. 

If you have a system already installed, the output of the prtconf command (line 2) reports the system's physical memory size.

model

platform_name

Matches a system's platform name. See Appendix C, Platform Names and Groups for a list of valid platform names.

To find the platform name of an installed system, use the uname -i command or the output of the prtconf command (line 5).


Note -

If the platform_name contains spaces, you must enclose it in single quotes ('). For example: 'SUNW,Sun 4_50'


network

network_num

Matches a system's network number, which the Solaris installation program determines by performing a logical AND between the system's IP address and the subnet mask.  

Example:  


network 193.144.2.0

The example tries to match a system with a 193.144.2.8 IP address (if the subnet mask were 255.255.255.0). 

osname

Solaris_2.x

Matches a version of Solaris software already installed on a system.  

Example:  


osname Solaris_2.5

The example tries to match a system with Solaris 2.5 already installed. 

totaldisk

size_range

The value must be specified as a range of Mbytes (xx-xx).

Matches the total disk space on a system (in Mbytes). The total disk space includes all the operational disks attached to a system. 

Example:  


totaldisk 300-500

The example tries to match a system with a total disk space between 300 and 500 Mbytes. 


Note -

When calculating size_range, remember that a Mbyte equals 1,048,576 bytes. A disk may be advertised as a "535 Mbyte" disk, but it may have only 510 million bytes of disk space. The Solaris installation program will actually view the "535 Mbyte" disk as a 510 Mbyte disk because 535,000,000 / 1,048,576 = 510. So, a "535 Mbyte" disk would not match a size_range equal to 530-550.