usr/lib/byobu/cpu_temp: find the temp monitor, LP: #676080

This commit is contained in:
Dustin Kirkland 2011-01-03 11:34:13 -06:00
commit 1997b0737b
2 changed files with 17 additions and 8 deletions

1
debian/changelog vendored
View file

@ -11,6 +11,7 @@ byobu (3.20) unreleased; urgency=low
usr/share/man/man1/Makefile.am:
- add an option for -n|--no-logout to byobu-launcher-install,
document changes in new manpages, LP: #604931
* usr/lib/byobu/cpu_temp: find the temp monitor, LP: #676080
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 28 Dec 2010 00:05:13 -0600

View file

@ -31,14 +31,22 @@ if [ "$1" = "--detail" ] && [ -d "$DIR" ]; then
exit 0
fi
for i in $MONITORED_TEMP /proc/acpi/ibm/thermal $DIR/*/temperature; do
if [ "$TEMP" = "F" ]; then
t=$(sed -e "s/^[^0-9]\+//" -e "s/\s.*$//" "$i" | awk '{printf "%.0f", $1 *9/5 + 32}')
unit="F"
else
t=$(sed -e "s/^[^0-9]\+//" -e "s/\s.*$//" "$i")
for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal $DIR/*/temperature; do
case "$i" in
*temp*_input)
t=$(awk '{printf "%0.f",$1/1000}' "$i")
;;
*)
t=$(sed -e "s/^[^0-9]\+//" -e "s/\s.*$//" "$i")
;;
esac
if [ -n "$t" ]; then
unit="C"
if [ "$TEMP" = "F" ]; then
t=$(echo "$t" | awk '{printf "%.0f", $1 *9/5 + 32}')
unit="F"
fi
printf "$(color b k Y)%s$(color -)$(color k Y)\260%s$(color -) " "$t" "$unit"
break
fi
printf "$(color b k Y)%s$(color -)$(color k Y)\260%s$(color -) " "$t" "$unit"
break
done