From 47129dd0d17fff8c938818ab768aee1ba84a6e98 Mon Sep 17 00:00:00 2001 From: openoms Date: Wed, 8 May 2019 13:48:35 +0100 Subject: [PATCH] fix CPU temp error on X86 --- build_sdcard.sh | 2 +- home.admin/00infoBlitz.sh | 6 +++++- home.admin/config.scripts/blitz.statusscan.sh | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/build_sdcard.sh b/build_sdcard.sh index 6544457..f53e423 100644 --- a/build_sdcard.sh +++ b/build_sdcard.sh @@ -41,7 +41,7 @@ echo "" echo "*** CHECK BASE IMAGE ***" # armv7=32Bit , armv8=64Bit -echo "Check if Linux ARM based ..." +echo "Detect CPU architecture ..." isARM=$(uname -m | grep -c 'arm') isAARCH64=$(uname -m | grep -c 'aarch64') isX86_64=$(uname -m | grep -c 'x86_64') diff --git a/home.admin/00infoBlitz.sh b/home.admin/00infoBlitz.sh index 3d25507..c6cfd17 100755 --- a/home.admin/00infoBlitz.sh +++ b/home.admin/00infoBlitz.sh @@ -50,7 +50,11 @@ lnd_macaroon_dir="/home/bitcoin/.lnd/data/chain/${network}/${chain}net" load=$(w | head -n 1 | cut -d 'v' -f2 | cut -d ':' -f2) # get CPU temp -cpu=$(cat /sys/class/thermal/thermal_zone0/temp) +isX86_64=$(uname -m | grep -c 'x86_64') +cpu=0 +if [ ${isX86_64} -eq 0 ] ; then + cpu=$(cat /sys/class/thermal/thermal_zone0/temp) +fi tempC=$((cpu/1000)) tempF=$(((cpu/1000) * (9/5) + 32)) diff --git a/home.admin/config.scripts/blitz.statusscan.sh b/home.admin/config.scripts/blitz.statusscan.sh index b170b17..a1bc10e 100644 --- a/home.admin/config.scripts/blitz.statusscan.sh +++ b/home.admin/config.scripts/blitz.statusscan.sh @@ -21,7 +21,11 @@ localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 echo "localIP='${localip}'" # temp -tempC=$(echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp)/1000" | bc) +isX86_64=$(uname -m | grep -c 'x86_64') +tempC=0 +if [ ${isX86_64} -eq 0 ] ; then + tempC=$(echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp)/1000" | bc) +fi echo "tempCelsius='${tempC}'" # uptime in seconds