Merge "dmidecode does not exist for ppc64/ppc64el"

This commit is contained in:
Jenkins 2016-06-30 05:00:02 +00:00 committed by Gerrit Code Review
commit 908ca1d079
3 changed files with 29 additions and 5 deletions

View File

@ -1,6 +1,12 @@
tgt:
curl:
# dmidecode does not exist for ppc* arches so add includes for non ppc
dmidecode:
arch: x86_64
dmidecode:
arch: i386
dmidecode:
arch: amd64
ipmitool:
qemu-utils:
gcc:

View File

@ -44,11 +44,22 @@ CPU_ARCH=$(lscpu | grep Architecture | awk '{ print $2 }')
update ".cpu_arch = \"$CPU_ARCH\""
RAM=0
if hash dmidecode 2>/dev/null; then
for i in $(dmidecode --type memory | grep Size | awk '{ print $2; }' | grep -E '[0-9]+');
do
RAM=$(( RAM + $i ));
done
update ".memory_mb = $RAM"
elif hash lshw 2>/dev/null; then
# dmidecode does not exist for ppc, but lshw should (for both)
MEMORY=$(lshw -c memory -short -quiet | grep -i 'system memory' | awk '{ print $3; }')
if [[ "${MEMORY}" =~ GiB$ ]]; then
RAMGB=${MEMORY::-3}
RAM=$(( RAMGB * 1024 ));
elif [[ "${MEMORY}" =~ MiB$ ]]; then
RAM=${MEMORY::-3}
fi
fi
[ ${RAM} -gt 0 ] && update ".memory_mb = $RAM"
CPUS=$(cat /proc/cpuinfo | grep processor | wc -l)
update ".cpus = $CPUS"

View File

@ -1,5 +1,12 @@
curl:
# dmidecode does not exist for ppc* arches so add includes for non ppc
dmidecode:
arch: x86_64
dmidecode:
arch: i386
dmidecode:
arch: amd64
ipmitool:
jq:
lshw:
util-linux: