The rules File

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

After deciding how you want each group of systems at your site to be installed, you need to create a rules file for each specific group of systems to be installed. The rules.ok file is a validated version of the rules file that the Solaris installation program uses to perform a custom JumpStart installation.

After you create the rules file, validate it with the check script by changing to the /export/jumpstart directory and issuing the check command. If the check script runs successfully, it creates the rules.ok file. During a custom JumpStart installation, the Solaris installation program reads the rules.ok file and tries to find the first rule that has a system attribute matching the system being installed. If a match occurs, the installation program uses the class file specified in the rule to install the system.

A sample rules file for a Sun Ultra is shown next. You’ll find a sample rules file on the install server located in the <install_dir_path>/Solaris_9/Misc/ jumpstart_sample directory, where <install_dir_path> is the directory that was specified using the setup_install_server script when the install server was set up. For the examples I use in this chapter, my install directory is /export/ jumpstart.

Notice that all the lines in the file are commented out. These are simply instructions and sample entries to help the system administrator make the correct entry. The last, uncommented line is the rule I added for the example. I’ll describe the syntax later. Each line in the code table has a rule keyword and a valid value for that keyword. The Solaris installation program scans the rules file from top to bottom. If the program matches an uncommented rule keyword and value with a known system, it installs the Solaris software specified by the class file listed in the class file field.

# 
#       @(#)rules 1.12 94/07/27 SMI 
# 
# The rules file is a text file used to create the rules.ok file for 
# a custom JumpStart installation. The rules file is a lookup table 
# consisting of one or more rules that define matches between system 
# attributes and profiles. 
# 
# This example rules file contains: 
#   o syntax of a rule used in the rules file 
#   o rule_keyword and rule_value descriptions 
#   o rule examples 
# 
# See the installation manual for a complete description of the rules file. 
# 
# 
############################################################################# 
# 
# RULE SYNTAX: 
# 
# [!]rule_keyword rule_value [&& [!]rule_keyword rule_value]... begin profile finish 
# 
#    "[ ]"  indicates an optional expression or field 
#    "..."  indicates the preceding expression may be repeated 
#     "&&"  used to "logically AND" rule_keyword and rule_value pairs together 
#      "!"  indicates negation of the following rule_keyword 
# 
#  rule_keyword       a predefined keyword that describes a general system 
#                     attribute. It is used with the rule_value to match a 
#                     system with the same attribute to a profile. 
# 
#  rule_value  a value that provides the specific system attribute 
#                     for the corresponding rule_keyword. A rule_value can 
#                     be text or a range of values (NN-MM). 
#                     To match a range of values, a system's value must be 
#                     greater than or equal to NN and less than or equal to MM. 
# 
#  begin       a file name of an optional Bourne shell script 
#              that will be executed before the installation begins. 
#              If no begin script exists, you must enter a minus sign(-)#  
               in this field. 
# 
#  profile     a file name of a text file used as a template by the 
#              custom JumpStart installation software that defines how 
#              to install Solaris on a system. 
# 
#  finish      a file name of an optional Bourne shell script 
#              that will be executed after the installation completes. 
#              If no finish script exists, you must enter a minus sign (-) 
#              in this field. 
# 
# Notes: 
# 1.        You can add comments after the pound sign (#) anywhere on a line. 
# 2.        Rules are matched in descending order: first rule through the last rule. 
# 3.        Rules can be continued to a new line by using the backslash () before 
#           the carriage return. 
# 4.        Don't use the "*" character or other shell wildcards, because the rules 
#           file is interpreted by a Bourne shell script. 
# 
# 
############################################################################# 
# 
# RULE_KEYWORD AND RULE_VALUE DESCRIPTIONS 
# 
# 
#        rule_keyword   rule_value Type     rule_value Description 
# ------------    ---------------       ----------------------
#        any   minus sign (-) always matches 
#        arch   text   system's architecture type 
#        domainname    text   system's domain name 
#        disksize      text range    system's disk size 
#                      disk device name (text) 
#                      disk size (MBytes range) 
#        hostname      text   system's host name 
#        installed     text text     system's installed version of Solaris 
#                      disk device name (text) 
#                      OS release (text) 
#        karch text    system's kernel architecture 
#        memsize       range  system's memory size (MBytes range) 
#        model text    system's model number 
#        network       text   system's IP address 
#        totaldisk     range  system's total disk size (MBytes range) 
# 
# 
############################################################################ 
# 
# RULE EXAMPLES 
# 
# The following rule matches only one system: 
# 
#hostname sample_host    -       host_class      set_root_pw 
# The following rule matches any system that is on the 924.222.43.0 network 
# and has the sun4u kernel architecture: 
#    Note: The backslash () is used to continue the rule to a new line.  
#network 924.222.43.0 &&  
#        karch sun4c    -       net924_sun4u     -
# The following rule matches any sparc system with a c0t3d0 disk that is  
# between 400 to 600 MBytes and has Solaris 2.1 installed on it: 
#arch sparc &&  
#               disksize c0t3d0 400-600 &&  
#               installed c0t3d0s0 solaris_2.1 - upgrade  -
# 
# The following rule matches all x86 systems: 
#arch i386   x86-begin   x86-class   -
# 
# The following rule matches any system: 
#any -   -   any_machine  -
# 
# END RULE EXAMPLES 
# 
# 
karch sun4u    -       basic_prof     -

Table 7.2 describes the syntax that the rules file must follow.

Table 7.2. Rules File Syntax
Field Description
! Use this before a rule keyword to indicate negation.
[ ] Use this to indicate an optional expression or field.
... Use this to indicate that the preceding expression might be repeated.
rule_keyword A predefined keyword that describes a general system attribute, such as a hostname (hostname) or the memory size (memsize).It is used with rule_value to match a system with the same attribute to a profile. The complete list of rule_keywords is described in Table 7.3.
rule_value Provides the specific system attribute value for the corresponding rule_keyword. See Table 7.3 for the list of rule_values.
&& Use this to join rule keyword and rule value pairs 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> 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 the section “begin and finish Scripts” for more information.
<profile> The name of the class file, a text file that defines how the Solaris software is installed on the system if a system matches the rule. The information in a class file consists of class file keywords and their corresponding class file values. All class files must reside in the JumpStart directory. class files are described in the section “Creating class Files.”
<finish> The 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 the section “begin and finish Scripts” for more information.

The rules file must have the following:

  • At least one rule

  • The name rules

  • At least a rule keyword, a rule value, and a corresponding profile

  • A minus sign (–) in the begin and finish fields if there is no entry

The rules file should be saved in the JumpStart directory, should be owned by root, and should have permissions equal to 644.

The following syntax applies to entries in the rules file:

  • A comment after the pound sign (#) anywhere on a line If a line begins with a #, the entire line is a comment. If a # is specified in the middle of a line, everything after the # is considered a comment.

  • Blank lines Any blank lines in the rules file are ignored.

  • Rules to span multiple lines You can let a rule wrap to a new line, or you can continue a rule on a new line by using a backslash () before Enter gets pressed.

Table 7.3 describes the various rule_keywords and rule_values that were introduced earlier.

Table 7.3. Rule Keyword and Rule Value Descriptions
Rule Keyword Rule Value Description
any Minus sign (–) The match always succeeds.
arch processor_type The following table lists the valid values for 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> <dlsk name> A disk name in the form c?t?d?, such as c0t3d0, or the special word rootdisk. If rootdlsk is used, the disk to be matched is determined in the following order:

1.The disk that contains the preinstalled boot image (a new SPAiRC-based system with factory JumpStart installed)

2.The c0t3d0s0 disk, if it exists.

3. The first available disk (searched in kernel probe order).

4. <size-range> The size of the disk, which must be specifiedas a range of MB (xx xx).
Matches a system's disk (in MB).

Example: dlskslze c0t3d0 1000-2000

This example tries to match a system with a c0t3d0 disk that is between 1GB and 2GB. Note: When calculating size-range, remember that a megabyte equals 1,048,576 bytes.
hostaddress <IP address> Matches a system’s IP address.
hostname <host name> Matches a system's hostname. If you have a system already installed, the uname -n command reports the system's hostname.
installed <s1ice> <verslon><s1ice> A disk slice name in the form c?t?d?s?, such as cOt3dOs5, or the special words any or rootdisk. If any is used, all 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 follow

1.The disk that contains the preinstalled boot image (a new SPAiRC-based system with factory JumpStart installed).

2.The cOt3desO if it exists.

3. The first available disk (searched in kernel probe order).

4. <version> A version name, Solaris_x, or the special words any or upgrade. If any is used, any Solaris or SunOS release is matched. If upgrade is used, any upgradeable 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 c0t3desl Solaris_9

This example tries to match a system that has a $olaris 9 root file system on cOt3dOsl.
karch <platform_group> Valid values are sun4m, sun4u, i86pc, and prep. 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 MB (xx-xx) or a single MB value. Matches a system’s physical memory size (in MB).

Example: memsize 64-128memory size (in MB).

This example tries to match a system with a physical memory size between 64MB and 128MB. 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. Any valid platform name will work.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 ('). Example: 'SUNW,Ultra-5_10'
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.1

This example tries to match a system with a 193.144.2.0 IP address (if the subnet mask were 255.255.255.0).
osname <Solaris_x> Matches a version of Solaris software already installed on a system. Example: osname Solaris_9 This example tries to match a system with Solaris 9 already installed.
totaldisk <size_range> The value must be specified as a range of MB (xx-xx). Matches the total disk space on a system (in MB). The total disk space includes all the operational disks attached to a system.

Example: totaldisk 1000-2000

This example tries to match a system with a total disk space between 1GB and 2GB.

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—the first rule through the last rule.

Note

The rules.ok file is derived from the rules file. I’ll explain how the rules.ok file is created in the next section.


A rule match occurs when the system being installed matches all 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 installing the software based on the matched rule’s class file. Here are a few sample rules:

karch sun4u  -  basic_prof  -

This specifies that the Solaris installation program should automatically install any system with the sun4u platform group based on the information in the basic_prof class file. There is no begin or finish script.

hostname pyramid2   -   ultra_class   -

This rule matches a system on the network called pyramid2. The class file to be used is named ultra_class. No begin or finish script is specified.

network 192.168.0.0 && ! model 'SUNW,Ultra-5_10' – net_class set_root_passwd 

This third rule matches any system on the network that is not an Ultra 5 or Ultra 10. The class file to be used is named net_class; the finish script to be run is named set_root_passwd.

any - - generic_class – 

This last example matches any system. The class file to be used is named generic_class, and there is no begin or finish script.

Validating the rules File

Before the rules file can be used, you must run the check script to validate that this file is set up correctly. If all the rules are valid, the rules.ok file is created.

To validate the rules file, use the check script provided in the <install_dir_path>/Solaris_9/Misc/jumpstart_sample directory on the install server.

Change the directory to the JumpStart directory and run the check script to validate the rules file:

<install_dir_path>/Solaris_9/Misc/jumpstart_sample/check [-p path] [-r file_name] 

<install_dir_path> is the directory that was specified using the setup_install_server script when the install server was setup.

The check script options are described in Table 7.4.

Table 7.4. check Script Options
Option Description
-p <path> Validates the rules file by using the check script from a specified Solaris 9 CD-ROM image instead of the check script from the system you are using. <path> is the pathname to a Solaris installation image on a local disk or a mounted Solaris CD-ROM. Use this option to run the most recent version of check if your system is running a previous version of Solaris.
-r <file_name> Specifies a rules file other than a file named rules. Using this option, you can test the validity of a rule before integrating it into the rules file. With this option, a rules.ok file is not created.

When you use check to validate a rules file, the following things happen:

1.
The rules file is checked for syntax. check makes sure that the rule keywords are legitimate, and the <begin>, <class>, and <finish> fields are specified for each rule.

2.
If no errors are found in the rules file, each class file specified in the rules file is checked for syntax. The class file must exist in the JumpStart installation directory and is covered in the next section.

3.
If no errors are found, check creates the rules.ok file from the rules file, removing all comments and blank lines, retaining all the rules, and adding the following comment line to the end:

version=2 checksum=<num> 

As the check script runs, it reports that it is checking the validity of the rules file and the validity of each class file. If no errors are encountered, it reports the following:

The custom JumpStart configuration is ok. 

The following is a sample session that uses check to validate a rules and class file. I created the files in the /tmp directory for this example; typically, they would be in your JumpStart directory. I named the rules file rulestest temporarily, the class file is named basic_prof, and I am using the -r option. With -r, the rules.ok file is not created, and only the rulestest file is checked.

#/export/jumpstart/install/Solaris_9/Misc/jumpstart_sample/check –r /tmp/rulestest 
Validating /tmp/rulestest... 
Validating profile basic_prof... 

Error in file "/tmp/rulestest", line 113 
              any - - any_maine -
ERROR: Profile missing: any_maine 

Note

Notice the use of the term profile in the error message. The terms profile and class file are interchangeable. You’ll see Sun refer to this file as a profile in its documentation, but the company refers to it as a class file in its training classes.


In this example, the check script found a bad option. I misspelled any_machine as any_maine. The check script reported this error.

In the next example, I fixed the error, copied the file from rulestest to rules, and reran the check script:

#cp rulestest rules 
#/export/jumpstart/install/Solaris_9/Misc/jumpstart_sample/check 
Validating /tmp/rules... 
Validating profile basic_prof... 
Validating profile any_machine... 
The custom JumpStart configuration is ok. 

As the check script runs, it reports that it is checking the validity of the rules file and the validity of each class file. If no errors are encountered, it reports that The custom JumpStart configuration is ok. The rules file is now validated.

After the rules.ok file is created, verify that it is owned by root and that it has permissions equal to 644.

begin and finish Scripts

A begin script is a user-defined Bourne shell script—located in the JumpStart configuration directory on the configuration server, specified within the rules file—that performs tasks before the Solaris software is installed on the system. You can set up begin scripts to perform the following tasks:

  • Backing up a file system before upgrading

  • Saving files to a safe location

  • Loading other applications

Output from the begin script goes to /var/sadm/begin.log.

Caution

Be careful not to specify something in the script that would prevent the mounting of file systems to /a during an initial or upgrade installation. If the Solaris installation program cannot mount the file systems to /a, an error occurs and the installation fails.


begin scripts should be owned by root and should have permissions equal to 744.

In addition to begin scripts, you can also have finish scripts. A finish script is a user-defined Bourne shell script—specified within the rules file— that performs tasks after the Solaris software is installed on the system but before the system restarts. finish scripts can be used only with custom JumpStart installations. You can set up finish scripts to perform the following tasks:

  • Moving saved files back into place

  • Adding packages or patches

  • Setting the system’s root password

Output from the finish script goes to /var/sadm/finish.log.

When used to add patches and software packages, begin and finish scripts can ensure that the installation is consistent between all systems.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset