refactor(master : nicsensor) 将所有的‘==’替换为‘=’
This commit is contained in:
parent
0f7ee5e040
commit
abd632d4f2
52
nicsensor.sh
52
nicsensor.sh
@ -218,7 +218,7 @@ format_log_print(){
|
|||||||
# @Param4 pca9548 channel
|
# @Param4 pca9548 channel
|
||||||
# @Param5 pcie slot number
|
# @Param5 pcie slot number
|
||||||
do_i2c_detect(){
|
do_i2c_detect(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
format_print $INFO "OCP slot $5 : bus$1 9548channel$4"
|
format_print $INFO "OCP slot $5 : bus$1 9548channel$4"
|
||||||
else
|
else
|
||||||
format_print $INFO "PCIe slot $5 : bus$1 9548channel$4"
|
format_print $INFO "PCIe slot $5 : bus$1 9548channel$4"
|
||||||
@ -237,7 +237,7 @@ reset_pca9548(){
|
|||||||
set_configuration_5280m7(){
|
set_configuration_5280m7(){
|
||||||
|
|
||||||
# set pca9641 address && I2C BUS
|
# set pca9641 address && I2C BUS
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
is_have_pca9641=0
|
is_have_pca9641=0
|
||||||
pca9548_slave="0x70"
|
pca9548_slave="0x70"
|
||||||
i2c_bus=3
|
i2c_bus=3
|
||||||
@ -255,7 +255,7 @@ set_configuration_5280m7(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# set pca9548 switch channel
|
# set pca9548 switch channel
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
if [ $slot_number -eq 0 ];then
|
if [ $slot_number -eq 0 ];then
|
||||||
pca9548_channel="0x01"
|
pca9548_channel="0x01"
|
||||||
elif [ $slot_number -eq 1 ];then
|
elif [ $slot_number -eq 1 ];then
|
||||||
@ -285,7 +285,7 @@ set_configuration_5280m7(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_configuration_5468m7(){
|
set_configuration_5468m7(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
||||||
format_print $INFO "Please check if script has update version"
|
format_print $INFO "Please check if script has update version"
|
||||||
exit 1
|
exit 1
|
||||||
@ -333,7 +333,7 @@ set_configuration_5468m7(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_configuration_donghu(){
|
set_configuration_donghu(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
||||||
format_print $INFO "Please check if script has update version"
|
format_print $INFO "Please check if script has update version"
|
||||||
exit 1
|
exit 1
|
||||||
@ -367,7 +367,7 @@ set_configuration_donghu(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_configuration_yichun(){
|
set_configuration_yichun(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
||||||
format_print $INFO "Please check if script has update version"
|
format_print $INFO "Please check if script has update version"
|
||||||
exit 1
|
exit 1
|
||||||
@ -392,7 +392,7 @@ set_configuration_yichun(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_configuration_qiandaohu(){
|
set_configuration_qiandaohu(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
||||||
format_print $INFO "Please check if script has update version"
|
format_print $INFO "Please check if script has update version"
|
||||||
exit 1
|
exit 1
|
||||||
@ -439,7 +439,7 @@ set_configuration_qiandaohu(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_configuration_5688m7(){
|
set_configuration_5688m7(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
||||||
format_print $INFO "Please check if script has update version"
|
format_print $INFO "Please check if script has update version"
|
||||||
exit 1
|
exit 1
|
||||||
@ -494,7 +494,7 @@ parse_nic_slot(){
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
slot_number=$(echo $nic_slot | cut -c 4)
|
slot_number=$(echo $nic_slot | cut -c 4)
|
||||||
else
|
else
|
||||||
if [ $fullname -eq 1 ];then
|
if [ $fullname -eq 1 ];then
|
||||||
@ -554,9 +554,9 @@ init_debuglog(){
|
|||||||
format_log_print $INFO "Debug Mode : $DEBUG_MODE"
|
format_log_print $INFO "Debug Mode : $DEBUG_MODE"
|
||||||
format_log_print $INFO "Disable Detect : $DISABLE_DETECT"
|
format_log_print $INFO "Disable Detect : $DISABLE_DETECT"
|
||||||
|
|
||||||
if [ "$nic_slot" == "detect" ];then
|
if [ "$nic_slot" = "detect" ];then
|
||||||
format_log_print $INFO "Operation Tpye : i2c detect"
|
format_log_print $INFO "Operation Tpye : i2c detect"
|
||||||
elif [ "$nic_slot" == "version" ];then
|
elif [ "$nic_slot" = "version" ];then
|
||||||
format_log_print $INFO "Operation Tpye : get version"
|
format_log_print $INFO "Operation Tpye : get version"
|
||||||
else
|
else
|
||||||
format_log_print $INFO "Operation Tpye : read sensor"
|
format_log_print $INFO "Operation Tpye : read sensor"
|
||||||
@ -619,7 +619,7 @@ pre_exec_hook(){
|
|||||||
init_debuglog
|
init_debuglog
|
||||||
|
|
||||||
# is param legel?
|
# is param legel?
|
||||||
if [ "$sensor_type" == "chip" ];then
|
if [ "$sensor_type" = "chip" ];then
|
||||||
if [ $param_num -le 3 ];then
|
if [ $param_num -le 3 ];then
|
||||||
format_print $ERROR "Command Format illegal"
|
format_print $ERROR "Command Format illegal"
|
||||||
print_chip_command_format
|
print_chip_command_format
|
||||||
@ -628,12 +628,12 @@ pre_exec_hook(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# if the action is fru write, need pre-process fru data
|
# if the action is fru write, need pre-process fru data
|
||||||
if [ "$sensor_type" == "fru" ];then
|
if [ "$sensor_type" = "fru" ];then
|
||||||
if [ "$option_data" == "write" ];then
|
if [ "$option_data" = "write" ];then
|
||||||
format_log_print $INFO "Opreation FRU Write"
|
format_log_print $INFO "Opreation FRU Write"
|
||||||
|
|
||||||
# is option_data(fru file name) valid?
|
# is option_data(fru file name) valid?
|
||||||
if [ "$option_data2" == "" ];then
|
if [ "$option_data2" = "" ];then
|
||||||
format_print $ERROR "Please provide fru file name"
|
format_print $ERROR "Please provide fru file name"
|
||||||
print_fru_command_format
|
print_fru_command_format
|
||||||
exit 1
|
exit 1
|
||||||
@ -1210,7 +1210,7 @@ process_fru(){
|
|||||||
# fru no need to init first
|
# fru no need to init first
|
||||||
|
|
||||||
# write and read fru
|
# write and read fru
|
||||||
if [ "$option_data" == "write" ];then
|
if [ "$option_data" = "write" ];then
|
||||||
write_fru
|
write_fru
|
||||||
else
|
else
|
||||||
# default action is read
|
# default action is read
|
||||||
@ -1270,7 +1270,7 @@ start_get_sensor(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
detect_on_5280m7(){
|
detect_on_5280m7(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
i2c_bus=3
|
i2c_bus=3
|
||||||
do_i2c_detect $i2c_bus 0x70 0x01 0 0
|
do_i2c_detect $i2c_bus 0x70 0x01 0 0
|
||||||
do_i2c_detect $i2c_bus 0x70 0x02 1 1
|
do_i2c_detect $i2c_bus 0x70 0x02 1 1
|
||||||
@ -1298,7 +1298,7 @@ detect_on_5280m7(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
detect_on_5468m7(){
|
detect_on_5468m7(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
||||||
format_print $INFO "Please check if script has update version"
|
format_print $INFO "Please check if script has update version"
|
||||||
exit 1
|
exit 1
|
||||||
@ -1329,7 +1329,7 @@ detect_on_5468m7(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
detect_on_donghu(){
|
detect_on_donghu(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
||||||
format_print $INFO "Please check if script has update version"
|
format_print $INFO "Please check if script has update version"
|
||||||
exit 1
|
exit 1
|
||||||
@ -1348,7 +1348,7 @@ detect_on_donghu(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
detect_on_yichun(){
|
detect_on_yichun(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
||||||
format_print $INFO "Please check if script has update version"
|
format_print $INFO "Please check if script has update version"
|
||||||
exit 1
|
exit 1
|
||||||
@ -1368,7 +1368,7 @@ detect_on_yichun(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
detect_on_qiandaohu(){
|
detect_on_qiandaohu(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
||||||
format_print $INFO "Please check if script has update version"
|
format_print $INFO "Please check if script has update version"
|
||||||
exit 1
|
exit 1
|
||||||
@ -1394,7 +1394,7 @@ detect_on_qiandaohu(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
detect_on_5688m7(){
|
detect_on_5688m7(){
|
||||||
if [ $nic_type == "ocp" ];then
|
if [ $nic_type = "ocp" ];then
|
||||||
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
format_print $ERROR "Unsupport OCP Nic on $server_type"
|
||||||
format_print $INFO "Please check if script has update version"
|
format_print $INFO "Please check if script has update version"
|
||||||
exit 1
|
exit 1
|
||||||
@ -1467,17 +1467,17 @@ start_detect_device(){
|
|||||||
|
|
||||||
pre_exec_hook
|
pre_exec_hook
|
||||||
|
|
||||||
if [ "$1" == "version" ];then
|
if [ "$1" = "version" ];then
|
||||||
echo "Script Version : $SCRIPT_VERSION"
|
echo "Script Version : $SCRIPT_VERSION"
|
||||||
echo "Debug Mode : $DEBUG_MODE"
|
echo "Debug Mode : $DEBUG_MODE"
|
||||||
echo "Disable Detect : $DISABLE_DETECT"
|
echo "Disable Detect : $DISABLE_DETECT"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "detect" ];then
|
if [ "$1" = "detect" ];then
|
||||||
if [ "$2" == "ocp" ];then
|
if [ "$2" = "ocp" ];then
|
||||||
nic_type="ocp"
|
nic_type="ocp"
|
||||||
elif [ "$2" == "pcie" ];then
|
elif [ "$2" = "pcie" ];then
|
||||||
nic_type="pcie"
|
nic_type="pcie"
|
||||||
else
|
else
|
||||||
format_print $WARNING "Please provide valid nic type, default to pcie"
|
format_print $WARNING "Please provide valid nic type, default to pcie"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user