2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

dodiscovery: Collapse unnecessary awk invocations into one (#4045)

This commit is contained in:
Samveen 2017-10-10 14:31:05 +07:00 committed by yangsong
parent 61805a19ab
commit 73e1912f93

View File

@ -99,17 +99,13 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86
if [ -z "$MTM" ]; then
FRU=`ipmitool fru print 0`
if [ $? -eq 0 ]; then
m=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {print $2}'`
n=`echo "$FRU" | awk -F': ' '/Product Name/ {print $2}'`
if [ -z "$n" -o "$n" == "NONE" ]; then
n=`echo "$FRU" | awk -F': ' '/Product Part Number/ {print $2}'`
fi
MTM=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {m=$2} /Product Name|Product Part Number/ {if (n==""||n=="NONE") {n=$2}} END {print m":"n}'`
else
logger -s -t $log_label -p local4.warning "Couldn't find MTM information in FRU, falling back to DMI (MTMS-based discovery may fail)"
m=`cat /sys/devices/virtual/dmi/id/sys_vendor`
n=`cat /sys/devices/virtual/dmi/id/product_name`
MTM="$m:$n"
fi
MTM="$m:$n"
fi
SERIAL=`cat /sys/devices/virtual/dmi/id/product_serial`
fi