From dab69d2860eafd326924b2c0259c2698cffa78ff Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Tue, 3 May 2016 13:11:28 +0200 Subject: [PATCH] Don't show errors when we are running non-privileged --- include/functions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/functions b/include/functions index 16919eb5..8800cd3f 100644 --- a/include/functions +++ b/include/functions @@ -1019,7 +1019,7 @@ elif [ -x /usr/sbin/dmidecode ]; then DMIDECODE_BINARY="/usr/sbin/dmidecode" else DMIDECODE_BINARY="" fi - if [ ! "${DMIDECODE_BINARY}" = "" ]; then + if [ ! "${DMIDECODE_BINARY}" = "" -a ${PRIVILEGED} -eq 1 ]; then LogText "Test: trying to guess virtualization with dmidecode" FIND=`/usr/sbin/dmidecode -s system-product-name | awk '{ print $1 }'` if [ ! "${FIND}" = "" ]; then @@ -1029,7 +1029,7 @@ LogText "Result: can't find product name with dmidecode" fi else - LogText "Result: dmidecode not found" + LogText "Result: dmidecode not found (or no access)" fi else LogText "Result: skipped dmidecode test, as we already found machine type" @@ -1039,7 +1039,7 @@ if [ "${SHORT}" = "" ]; then if [ -x /usr/bin/lshw ]; then LogText "Test: trying to guess virtualization with lshw" - FIND=`lshw -quiet -class system | awk '{ if ($1=="product:") { print $2 }}'` + FIND=`lshw -quiet -class system 2> /dev/null | awk '{ if ($1=="product:") { print $2 }}'` if [ ! "${FIND}" = "" ]; then LogText "Result: found ${FIND}" SHORT="${FIND}"