fix: handle multiple CPU models returned via lscpu; Asahi Linux for example

This commit is contained in:
Martin Wimpress 2024-05-17 13:18:19 +01:00 committed by Martin Wimpress
parent b009e5cef5
commit dbe9f612fb
1 changed files with 4 additions and 2 deletions

View File

@ -240,9 +240,11 @@ function get_cpu_info() {
fi
else
if [ "^Model name:" == "${INFO_NAME}" ]; then
lscpu | grep "${INFO_NAME}" | cut -d':' -f2 | sed -e 's/^[[:space:]]*//'
for MODEL_NAME in $(IFS=$'\n' lscpu | grep "${INFO_NAME}" | cut -d':' -f2 | sed -e 's/^[[:space:]]*//'); do
echo -n "${MODEL_NAME} "
done
else
lscpu | grep -E "${INFO_NAME}" | cut -d':' -f2 | sed 's/ //g'
lscpu | grep -E "${INFO_NAME}" | cut -d':' -f2 | sed 's/ //g' | sort -u
fi
fi
}