Solaris 9 安裝指南

custom_probes 檔與關鍵字的範例

您可以在下列目錄中尋找探測與比較函式的其他範例:

下列 custom_probes 檔包含探測函式與比較函式,用於測試 TCX 圖形卡是否存在。


範例 25-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

}

下列範例 rules 檔將顯示如何使用之前範例 tcx 所定義的探測關鍵字。如果在系統中安裝並找到 TCX 圖形卡,則會執行 profile_tcx。否則便執行 profile


註解 -

請務必在 rules 檔案的開始處或附近放置探測關鍵字,以確保在其他可能依賴該探測關鍵字的規則關鍵字之前讀取並執行該關鍵字。



範例 25-2 rules 檔案使用的自訂探測關鍵字

probe tcx

tcx     tcx     -     profile_tcx     -

any     any     -     profile         -