Solaris 9 9/04 Installation Guide

Examples of a custom_probes File and Keyword

You can find additional examples of probe and comparison functions in the following directories:

The following custom_probes file contains a probe and comparison function that tests for the presence of a TCX graphics card.


Example 28–1 custom_probes File

#!/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
}

The following example rules file shows the use of the probe keyword that is 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.


Note –

Always place probe keywords at or near the beginning of the rules file to ensure that the keywords are read and run before other rule keywords that might rely on the probe keywords.



Example 28–2 Custom Probe Keyword Used in a rules File

probe tcx
tcx     tcx     -     profile_tcx     -
any     any     -     profile         -