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