autocore-arm: simplify script

This commit is contained in:
CN_SZTL 2020-08-01 19:30:37 +08:00
parent f00da71172
commit 7f8ab7ca11
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
3 changed files with 5 additions and 14 deletions

View File

@ -46,11 +46,7 @@ define Package/autocore-arm/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/arm/090-cover-index_files $(1)/etc/uci-defaults/090-cover-index_files
$(INSTALL_DIR) $(1)/sbin
ifneq ($(BOARD),ipq40xx)
$(INSTALL_BIN) ./files/arm/cpuinfo $(1)/sbin/cpuinfo
else
$(INSTALL_BIN) ./files/arm/cpuinfo-ipq40xx $(1)/sbin/cpuinfo
endif
endef
define Package/autocore-x86/install

View File

@ -5,6 +5,10 @@ cpu_arch="$(cat "/proc/cpuinfo" | grep "model name" | sed -n "1p" | awk -F ': '
cpu_cores="$(cat "/proc/cpuinfo" | grep "processor" | wc -l)"
cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq) / 1000)MHz"
sys_temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat /sys/class/thermal/thermal_zone0/temp)/1000) }")°C"
if grep -q "ipq40xx" "/etc/openwrt_release"; then
sys_temp="$(sensors | grep -Eo '\+[0-9]+.+C' | sed ':a;N;$!ba;s/\n/ /g;s/+//g')"
else
sys_temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat /sys/class/thermal/thermal_zone0/temp)/1000) }")°C"
fi
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq}, ${sys_temp})"

View File

@ -1,9 +0,0 @@
#!/bin/sh
cpu_arch="$(cat "/proc/cpuinfo" | grep "model name" | sed -n "1p" | awk -F ': ' '{print $2}')"
cpu_cores="$(cat "/proc/cpuinfo" | grep "processor" | wc -l)"
cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq) / 1000)MHz"
sys_temp="$(sensors | grep -Eo '\+[0-9]+.+C' | sed ':a;N;$!ba;s/\n/ /g;s/+//g')"
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq}, ${sys_temp})"