From 0cfdb8c7e4356bd878d94c40ca70e98474e3958d Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Sun, 18 May 2025 17:50:17 +0200 Subject: [PATCH] Allwinner: Replace bc with awk for floating-point comparison in temperature check --- .../bsp/common/usr/lib/armbian/armbian-allwinner-battery | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bsp/common/usr/lib/armbian/armbian-allwinner-battery b/packages/bsp/common/usr/lib/armbian/armbian-allwinner-battery index 5d18d017f..85cf35c78 100755 --- a/packages/bsp/common/usr/lib/armbian/armbian-allwinner-battery +++ b/packages/bsp/common/usr/lib/armbian/armbian-allwinner-battery @@ -11,11 +11,11 @@ function getboardtemp() { if [ -f /etc/armbianmonitor/datasources/soctemp ]; then read raw_temp /dev/null - if [ ! -z $(echo "$raw_temp" | grep -o "^[1-9][0-9]*\.\?[0-9]*$") ] && (( $(echo "${raw_temp} < 200" |bc -l) )); then - # Allwinner legacy kernels output degree C + if [[ "$raw_temp" =~ ^[1-9][0-9]*\.?[0-9]*$ ]] && awk "BEGIN {exit !($raw_temp < 200)}"; then + # Allwinner legacy kernels output degree C board_temp=${raw_temp} else - board_temp=$(awk '{printf("%d",$1/1000)}' <<<${raw_temp}) + board_temp=$(awk '{printf("%d",$1/1000)}' <<<"${raw_temp}") fi elif [ -f /etc/armbianmonitor/datasources/pmictemp ]; then # fallback to PMIC temperature