Package: powermgmt-base
Version: 1.31+nmu1
Severity: important
Tags: patch newcomer

On a workstation system, on_ac_power gives 255 as exit code because it
was unable to determine the power source.

This would in turn make git think the system is on battery, and refuse
to automatically perform garbage collection.

The proposed patch will tell the caller that AC power is present when
there is no battery.

%%%%%%%
--- /sbin/on_ac_power   2009-12-02 00:57:18.000000000 -0800
+++ ./on_ac_power       2017-11-29 15:09:09.255660304 -0800
@@ -23,6 +23,9 @@
 OFF_LINE_P=no
 
 if [ -d /sys/class/power_supply/ ]; then
+    if ! test -d /sys/module/battery; then
+      exit 0
+    fi
     for FN in /sys/class/power_supply/*; do
        if test -d "${FN}" && test -r "${FN}/type"; then
            type="$(cat ${FN}/type)"
%%%%%%%

Reply via email to