mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
hooks/pre-auto-gc: look in sysfs to see if a battery is known.
Barring any kernel bugs, if this directory exists and there is a symlink in there (which will point to the battery object), that means there is a battery known to the kernel. No symlink should mean no battery as far as the kernel is concerned. Change-Id: Ib12819a5bbb816f0ae5ca080e5812a2db08441e9
This commit is contained in:
parent
eca119e5d6
commit
6a927c5d19
@ -38,6 +38,11 @@ elif test -x /usr/bin/pmset && /usr/bin/pmset -g batt |
|
|||||||
grep -q "Currently drawing from 'AC Power'"
|
grep -q "Currently drawing from 'AC Power'"
|
||||||
then
|
then
|
||||||
exit 0
|
exit 0
|
||||||
|
elif test -d /sys/bus/acpi/drivers/battery && test 0 = \
|
||||||
|
"$(find /sys/bus/acpi/drivers/battery/ -type l | wc -l)";
|
||||||
|
then
|
||||||
|
# No battery exists.
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Auto packing deferred; not on AC"
|
echo "Auto packing deferred; not on AC"
|
||||||
|
Loading…
Reference in New Issue
Block a user