refactor(script : nicsensor.sh)Update to version 1.2 Intest Rev8
1.重构if else语句为case语句
This commit is contained in:
parent
9eb8564b6c
commit
a3b2c16198
@ -133,7 +133,7 @@ ina3221_ch2_volt="0"
|
||||
ina3221_ch0_current="0"
|
||||
ina3221_ch1_current="0"
|
||||
ina3221_ch2_current="0"
|
||||
SCRIPT_VERSION="1.2 InTest Rev7"
|
||||
SCRIPT_VERSION="1.2 InTest Rev8"
|
||||
|
||||
fru_file_name=$option_data2
|
||||
fru_write_size=0
|
||||
@ -375,20 +375,27 @@ set_configuration(){
|
||||
format_log_print $INFO "Server Type : $server_type"
|
||||
|
||||
# 根据服务器型号执行对应的配置策略
|
||||
if [ $server_type == "5280m7" ];then
|
||||
set_configuration_5280m7
|
||||
elif [ $server_type == "5468m7" ];then
|
||||
set_configuration_5468m7
|
||||
elif [ $server_type == "donghu" ];then
|
||||
set_configuration_donghu
|
||||
elif [ $server_type == "yichun" ];then
|
||||
set_configuration_yichun
|
||||
elif [ $server_type == "qiandaohu" ];then
|
||||
set_configuration_qiandaohu
|
||||
else
|
||||
format_print $ERROR "Error: Unsupport Server Type !!! - $server_type"
|
||||
exit 1
|
||||
fi
|
||||
case $server_type in
|
||||
"5280m7")
|
||||
set_configuration_5280m7
|
||||
;;
|
||||
"5468m7")
|
||||
set_configuration_5468m7
|
||||
;;
|
||||
"donghu")
|
||||
set_configuration_donghu
|
||||
;;
|
||||
"yichun")
|
||||
set_configuration_yichun
|
||||
;;
|
||||
"qiandaohu")
|
||||
set_configuration_qiandaohu
|
||||
;;
|
||||
*)
|
||||
format_print $ERROR "Error: Unsupport Server Type !!! - $server_type"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# 初始化调试日志
|
||||
@ -916,20 +923,27 @@ start_get_sensor(){
|
||||
fi
|
||||
|
||||
# get sensor detail value
|
||||
if [ "$sensor_type" == "emc1413" ];then
|
||||
process_emc1413
|
||||
elif [ "$sensor_type" == "adc128" ];then
|
||||
process_adc128
|
||||
elif [ "$sensor_type" == "ina3221" ];then
|
||||
process_ina3221
|
||||
elif [ "$sensor_type" == "chip" ];then
|
||||
process_chip
|
||||
elif [ "$sensor_type" == "fru" ];then
|
||||
process_fru
|
||||
else
|
||||
format_print $ERROR "Unsupport Sensor Type !!!"
|
||||
print_usage
|
||||
fi
|
||||
case $sensor_type in
|
||||
"emc1413")
|
||||
process_emc1413
|
||||
;;
|
||||
"adc128")
|
||||
process_adc128
|
||||
;;
|
||||
"ina3221")
|
||||
process_ina3221
|
||||
;;
|
||||
"chip")
|
||||
process_chip
|
||||
;;
|
||||
"fru")
|
||||
process_fru
|
||||
;;
|
||||
*)
|
||||
format_print $ERROR "Unsupport Sensor Type !!!"
|
||||
print_usage
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# 在 5280m7 上扫描每个pcie slot下的I2C设备
|
||||
@ -1033,19 +1047,26 @@ start_detect_device(){
|
||||
fi
|
||||
|
||||
format_print $INFO "Detect on server : $server_type"
|
||||
if [ $server_type == "5280m7" ];then
|
||||
detect_on_5280m7
|
||||
elif [ $server_type == "5468m7" ];then
|
||||
detect_on_5468m7
|
||||
elif [ $server_type == "donghu" ];then
|
||||
detect_on_donghu
|
||||
elif [ $server_type == "yichun" ];then
|
||||
detect_on_yichun
|
||||
elif [ $server_type == "qiandaohu" ];then
|
||||
detect_on_qiandaohu
|
||||
else
|
||||
format_print $ERROR "Unsupport Server Type !!!"
|
||||
fi
|
||||
case $server_type in
|
||||
"5280m7")
|
||||
detect_on_5280m7
|
||||
;;
|
||||
"5468m7")
|
||||
detect_on_5468m7
|
||||
;;
|
||||
"donghu")
|
||||
detect_on_donghu
|
||||
;;
|
||||
"yichun")
|
||||
detect_on_yichun
|
||||
;;
|
||||
"qiandaohu")
|
||||
detect_on_qiandaohu
|
||||
;;
|
||||
*)
|
||||
format_print $ERROR "Unsupport Server Type - $server_type !!!"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user