From d9919fd1da231cc00b04df86c3ded042e8506f3c Mon Sep 17 00:00:00 2001 From: Ing Date: Sat, 19 Oct 2024 15:50:59 +0800 Subject: [PATCH] Refactor get DMI function --- files/initrd/opt/rr/boot.sh | 2 +- files/initrd/opt/rr/menu.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/initrd/opt/rr/boot.sh b/files/initrd/opt/rr/boot.sh index 1fbd8523..0afad891 100755 --- a/files/initrd/opt/rr/boot.sh +++ b/files/initrd/opt/rr/boot.sh @@ -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" diff --git a/files/initrd/opt/rr/menu.sh b/files/initrd/opt/rr/menu.sh index 0628f6d2..77e35ca1 100755 --- a/files/initrd/opt/rr/menu.sh +++ b/files/initrd/opt/rr/menu.sh @@ -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}"