feat(master : nicsensor)添加功能: 根据boardid自动匹配服务器型号
This commit is contained in:
parent
1e2f32dce3
commit
6eacac1f1a
31
nicsensor.sh
31
nicsensor.sh
@ -59,7 +59,7 @@ fru_offset="0x00 0x00"
|
||||
Support_Sensor_List="emc1413, adc128, ina3221, tmp468, tmp112"
|
||||
Support_Server_List="5280m7, 5468m7, 5688m7, donghu, yichun, qiandaohu"
|
||||
# Which server will use this script
|
||||
server_type="5280m7"
|
||||
server_type="default"
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Common Varible (Don't Change)
|
||||
@ -264,6 +264,30 @@ parse_nic_slot(){
|
||||
format_log_print $INFO "Slot Num : $slot_number"
|
||||
}
|
||||
|
||||
# According to boardid, parse server_type
|
||||
try_get_server_type(){
|
||||
if [ -e "/tmp/ns_servertype" ];then
|
||||
server_type=`cat /tmp/ns_servertype`
|
||||
else
|
||||
boardid=`cat /proc/cmdline | awk -F'=' '/boardid=/{print $8; exit}'`
|
||||
|
||||
if [ $boardid -eq 130 ];then
|
||||
server_type="5280m7"
|
||||
elif [ $boardid -eq 150 ];then
|
||||
server_type="5468m7"
|
||||
elif [ $boardid -eq 152 ];then
|
||||
server_type="5688m7"
|
||||
else
|
||||
format_print $ERROR "Invalid boardid value: $boardid"
|
||||
format_print $ERROR "Can't specify server type by general method"
|
||||
format_print $INFO "Please modify server_type in script manually!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $server_type > /tmp/ns_servertype
|
||||
fi
|
||||
}
|
||||
|
||||
init_debuglog(){
|
||||
# only save one running log
|
||||
if [ -e $log ];then
|
||||
@ -343,6 +367,11 @@ switch_pca9548_channel(){
|
||||
pre_exec_hook(){
|
||||
init_debuglog
|
||||
|
||||
# check server_type if is default
|
||||
if [ "$server_type" = "default" ];then
|
||||
try_get_server_type
|
||||
fi
|
||||
|
||||
# is param legel?
|
||||
if [ "$sensor_type" = "chip" ];then
|
||||
if [ $param_num -le 3 ];then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user