Fix acpi -b output check to define get_battery
This commit is contained in:
parent
41cb522d2c
commit
201ba38b2a
@ -8,21 +8,27 @@ if [ ! -d $cache_dir ]; then
|
|||||||
mkdir -p $cache_dir
|
mkdir -p $cache_dir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if sensors 'coretemp-isa-0000' &> /dev/null; then
|
if command -v sensors &> /dev/null; then
|
||||||
function get_cpu_temp() {
|
if sensors 'coretemp-isa-0000' &> /dev/null; then
|
||||||
sensors 'coretemp-isa-0000' | awk 'NR == 3 { print substr($4, 2) }'
|
function get_cpu_temp() {
|
||||||
}
|
sensors 'coretemp-isa-0000' | awk 'NR == 3 { print substr($4, 2) }'
|
||||||
elif sensors 'k10temp-pci-00c3' &> /dev/null; then
|
}
|
||||||
function get_cpu_temp {
|
elif sensors 'k10temp-pci-00c3' &> /dev/null; then
|
||||||
sensors 'k10temp-pci-00c3' | grep 'Tctl:' | awk '{ print $2 }'
|
function get_cpu_temp {
|
||||||
}
|
sensors 'k10temp-pci-00c3' | grep 'Tctl:' | awk '{ print $2 }'
|
||||||
|
}
|
||||||
|
else
|
||||||
|
function get_cpu_temp {
|
||||||
|
echo ''
|
||||||
|
}
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
function get_cpu_temp {
|
function get_cpu_temp {
|
||||||
echo 'N/A°C'
|
echo 'N/A°C'
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "`acpi -b`" != "No support for device type: power_supply" ]; then
|
if [[ "$(acpi -b 2>&1 /dev/null)" != "No support for device type: power_supply" ]]; then
|
||||||
function get_battery {
|
function get_battery {
|
||||||
local output=$(acpi -b)
|
local output=$(acpi -b)
|
||||||
local charging=$(echo $output | awk '{ print $3 }')
|
local charging=$(echo $output | awk '{ print $3 }')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user