Refactor get DMI function

This commit is contained in:
Ing 2024-10-19 15:50:59 +08:00
parent 33135b6bcd
commit d9919fd1da
2 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ SMALLNUM="$(readConfigKey "smallnum" "${USER_CONFIG_FILE}")"
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
DMI="$(dmesg 2>/dev/null | grep -i "DMI:" | sed 's/\[.*\] DMI: //i')"
DMI="$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')"
CPU="$(echo $(cat /proc/cpuinfo 2>/dev/null | grep 'model name' | uniq | awk -F':' '{print $2}'))"
MEM="$(awk '/MemTotal:/ {printf "%.0f", $2 / 1024}' /proc/meminfo 2>/dev/null) MB"

View File

@ -166,7 +166,7 @@ function modelMenu() {
fi
# If user change model, clean build* and pat* and SN
if [ "${MODEL}" != "${resp}" ]; then
PLATFORM="$(grep -w "${resp}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
PLATFORM="$(grep -w "${resp}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -1)"
MODEL="${resp}"
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"