If the rule and probe keywords described in Table 6-3 and Table 8-1 are not enough for your needs, you can define your own custom rule or probe keywords by creating a custom_probes file.
The custom_probes file, which must be located in the same JumpStart directory as the rules file, is a Bourne shell script that contains two types of functions.
Table 8-2 Types of Functions You Define in custom_probes
Type of Function |
Description |
---|---|
Probe |
Gathers the information you want or does the actual work and sets a corresponding SI_ environment variable you define. Probe functions become probe keywords. |
Comparison |
Calls a corresponding probe function, compares the output of the probe function, and returns 0 if the keyword matches or 1 if the keyword doesn't match. Comparison functions become rule keywords. |
The custom_probes file can contain any valid Bourne shell command, variable, or algorithm.
You can define probe and comparison functions that require a single argument in the custom_probes file. When you subsequently use the corresponding custom probe keyword in the rules file, the argument after the keyword is interpreted (as $1).
When you subsequently use the corresponding custom rule keyword in the rules file, the argument is interpreted starting after the keyword and ending before the next && or begin script, whichever comes first.
Be owned by root
Be executable (have its permissions set to 755)
Contain at least one probe function and one corresponding comparison function
To improve clarity and organization, define all probe functions first, at the top of the file, followed by all comparison functions.
The name of a probe function must begin with probe_. The name of a comparison function must begin with cmp_.
Functions that begin with probe_ define new probe keywords (the function probe_tcx defines the new probe keyword tcx, for example). Functions that begin with cmp_ define new rule keywords (cmp_tcx defines the new rule keyword tcx, for example).
This custom_probes file contains a probe and comparison function that tests for the presence of a TCX graphics card.
You can find additional examples of probe and comparison functions in:
/usr/sbin/install.d/chkprobe on a system that has Solaris installed
/Solaris_8/Tools/Boot/usr/sbin/install.d/chkprobe on the CD labeled Solaris 8 Software 1 of 2 SPARC Platform Edition or Solaris 8 Software 1 of 2 Intel Platform Edition
#!/bin/sh # # custom_probe script to test for the presence of a TCX graphics card. # # # PROBE FUNCTIONS # probe_tcx() { SI_TCX=`modinfo | grep tcx | nawk '{print $6}'` export SI_TCX } # # COMPARISON FUNCTIONS # cmp_tcx() { probe_tcx if [ "X${SI_TCX}" = "X${1}" ]; then return 0 else return 1 fi } |
This example rules file shows the use of the probe keyword defined in the preceding example (tcx). If a TCX graphics card is installed and found in a system, profile_tcx is run. Otherwise, profile is run.
Always place probe keywords at or near the beginning of the rules file to ensure that they are read and run before other rule keywords (that may rely on them).
probe tcx tcx tcx - profile_tcx - any any - profile - |
Using a text editor of your choice, create a Bourne shell script text file named custom_probes.
In the custom_probes text file, define the probe and comparison functions you want.
You can define probe and comparison functions that require arguments in the custom_probes file. When you subsequently use the corresponding custom probe keyword in the rules file, the arguments after the keyword are interpreted in sequence (as $1, $2, and so on).
When you subsequently use the corresponding custom rule keyword in the rules file, the arguments are interpreted in sequence starting after the keyword and ending before the next && or begin script, whichever comes first.
Save the custom_probes file in the JumpStart directory (next to the rules file).
Ensure that root owns the rules file and that its permissions are set to 644.