Solaris 9 安装指南

custom_probes 文件和关键字的示例

在以下目录中可以找到探测和比较函数的其它示例:

下面的 custom_probes 文件包含测试 TCX 图形卡是否存在的探测和比较函数。


实例 25–1 custom_probes 文件

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

}

下面的示例 rules 文件显示如何使用前面的示例 tcx 中定义的探测关键字。如果 TCX 图形卡已安装并在系统中被找到,则运行 profile_tcx。否则,运行 profile


注意:

始终将探测关键字放在 rules 文件的开头或接近开头的位置,以确保能够在其它可能依赖这些探测关键字的规则关键字之前读取和运行这些关键字。



实例 25–2 定制 rules 文件中使用的探测关键字

probe tcx

tcx     tcx     -     profile_tcx     -

any     any     -     profile         -