fix(logging): fixes error in log output of host information

This fixes error thet leads to unwanted multiple output of
lines of used model if raspberry sbc.

Signed-off-by: Stephan Wendel <me@stephanwe.de>
This commit is contained in:
Stephan Wendel
2022-06-16 10:14:26 +02:00
parent c52cf40a96
commit b6055cecff

View File

@@ -119,7 +119,7 @@ function print_cams {
function print_host {
local disksize generic_model memtotal sbc_model
generic_model="$(grep "model name" /proc/cpuinfo | cut -d':' -f2)"
generic_model="$(grep "model name" /proc/cpuinfo | cut -d':' -f2 | awk NR==1)"
sbc_model="$(grep "Model" /proc/cpuinfo | cut -d':' -f2)"
memtotal="$(grep "MemTotal:" /proc/meminfo | awk '{print $2" "$3}')"
disksize="$(LC_ALL=C df -h / | awk 'NR==2 {print $4" / "$2}')"
@@ -143,7 +143,8 @@ function print_host {
if [ -n "${sbc_model}" ]; then
log_msg "Host Info: Model: ${sbc_model}"
fi
if [ -n "${generic_model}" ]; then
if [ -n "${generic_model}" ] &&
[ -z "${sbc_model}" ]; then
log_msg "Host Info: Model: ${generic_model}"
fi
## CPU count