在以下目录中可以找到探测函数和比较函数的其它示例:
/usr/sbin/install.d/chkprobe(在安装了 Solaris 软件的系统上)
/Solaris_9/Tools/Boot/usr/sbin/install.d/chkprobe (在 Solaris 9 DVD 或 Solaris 9 Software 1 of 2 CD 上)
下面的 custom_probes 文件包含测试 TCX 图形卡是否存在的探测函数和比较函数。
#!/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 文件的开头或接近开头的位置,以确保能够在其它可能依赖这些探测关键字的规则关键字之前读取和运行这些关键字。
probe tcx tcx tcx - profile_tcx - any any - profile - |