Fix discoverd bug when dmidecode reports GB

This fix uses dmidecode and awk to simply multiply by 1024 when
the value is represented in GB, otherwise it returns the given
value.  I should note that I've only observered this occurence
on "some" SuperMicro Hardware

Closes-Bug: #1486689

Change-Id: I352b1891326f72af3a56c7bbe8b7f3c422169404
This commit is contained in:
Joey D 2015-12-16 20:05:29 -06:00
parent 3a110bf96f
commit 802f14862c

View File

@ -44,7 +44,7 @@ CPU_ARCH=$(lscpu | grep Architecture | awk '{ print $2 }')
update ".cpu_arch = \"$CPU_ARCH\""
RAM=0
for i in $(dmidecode --type memory | grep Size | awk '{ print $2; }' | grep -E '[0-9]+');
for i in $(dmidecode --type memory | awk '($0~/Size/ && $2~/[0-9]/) {($3~/GB/) ? size=$2*1024 : size=$2; {print size;}}')
do
RAM=$(( RAM + $i ));
done