autocore: style improvements

Acked-by: AmadeusGhost <amadeus@project-openwrt.eu.org>
Signed-off-by: CN_SZTL <cnsztl@project-openwrt.eu.org>
This commit is contained in:
CN_SZTL 2021-02-06 04:10:25 +08:00
parent e06823880d
commit 2a4203c81e
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 16 additions and 21 deletions

View File

@ -12,7 +12,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=autocore
PKG_VERSION:=1
PKG_RELEASE:=38
PKG_RELEASE:=39
include $(INCLUDE_DIR)/package.mk

View File

@ -10,28 +10,23 @@ elif grep -q "bcm53xx" "/etc/openwrt_release"; then
cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz"
elif grep -q "mvebu" "/etc/openwrt_release"; then
cpu_freq="$(cat "/proc/cpuinfo" | grep "BogoMIPS" | sed -n "1p" | awk -F ': ' '{print $2}')MHz"
else
cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq) / 1000)MHz"
elif [ -e "/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq" ]; then
cpu_freq="$(expr $(cat "/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq") / 1000)MHz"
fi
if grep -q "ipq" "/etc/openwrt_release"; then
if grep -q "bcm27xx" "/etc/openwrt_release"; then
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C"
else
[ -e "/sys/class/thermal/thermal_zone0/temp" ] && \
cpu_temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat "/sys/class/thermal/thermal_zone0/temp")/1000)}")°C"
fi
if [ -z "${cpu_freq}" ] && [ -z "${cpu_temp}" ]; then
echo -n "${cpu_arch} x ${cpu_cores}"
elif [ -z "${cpu_temp}" ] || grep -q "ipq" "/etc/openwrt_release"; then
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq})"
elif [ -z "${cpu_freq}" ]; then
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_temp})"
else
if grep -q "bcm27xx" "/etc/openwrt_release"; then
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C"
else
if [ -f /sys/class/thermal/thermal_zone0/temp ]; then
cpu_temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat /sys/class/thermal/thermal_zone0/temp)/1000) }")°C"
fi
fi
if grep -q "sunxi" "/etc/openwrt_release"; then
if [ -f /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq ]; then
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq})"
else
echo -n "${cpu_arch} x ${cpu_cores}"
fi
else
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq}, ${cpu_temp})"
fi
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq}, ${cpu_temp})"
fi