autocore: support fetch temperature info via wechatpush
It is possible to display the host machine's temperature on the "Overview" page of OpenWrt running in a virtual machine. However, to enable this feature, additional configuration is required, including setting up SSH keys and providing the host machine's IP address. Therefore, the command actually checks whether the "luci-app-wechatpush" plugin has enabled the feature to retrieve the host machine's temperature. If it is enabled, the command will invoke /usr/share/wechatpush/wechatpush soc to obtain the temperature.
This commit is contained in:
parent
31497457df
commit
93bb78c899
@ -38,7 +38,9 @@ case "$DISTRIB_TARGET" in
|
|||||||
"bcm27xx"/*)
|
"bcm27xx"/*)
|
||||||
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C" ;;
|
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C" ;;
|
||||||
"x86"/*)
|
"x86"/*)
|
||||||
if grep -q "GenuineIntel" "/proc/cpuinfo"; then
|
if [ -n "$(uci -q get "wechatpush.config.server_host")" ]; then
|
||||||
|
cpu_temp="$(/usr/share/wechatpush/wechatpush soc)°C"
|
||||||
|
elif grep -q "GenuineIntel" "/proc/cpuinfo"; then
|
||||||
cpu_temp="$(sensors "coretemp-*" 2>"/dev/null" | grep -E "(Package id |Core )" | grep -Eo "\+[0-9.]*°C" | head -n1 | tr -d "+")"
|
cpu_temp="$(sensors "coretemp-*" 2>"/dev/null" | grep -E "(Package id |Core )" | grep -Eo "\+[0-9.]*°C" | head -n1 | tr -d "+")"
|
||||||
elif grep -q "AuthenticAMD" "/proc/cpuinfo"; then
|
elif grep -q "AuthenticAMD" "/proc/cpuinfo"; then
|
||||||
cpu_temp="$(sensors "k*temp-*" 2>"/dev/null" | awk '/Tdie/ {print $2}' | head -n1 | tr -d "+")"
|
cpu_temp="$(sensors "k*temp-*" 2>"/dev/null" | awk '/Tdie/ {print $2}' | head -n1 | tr -d "+")"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user