Open comio opened 6 years ago
@sten0, Can you review the proposed code.
Can you attach output of find /sys/class/power_supply -name online
?. Thanks.
luigi
@comio No output. Linux-4.9.80 on Debian 9. /sys/class/power_supply/AC: symbolic link to ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:08/PNP0C09:00/ACPI0003:00/power_supply/AC /sys/class/power_supply/BAT0: symbolic link to ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:08/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
On the other hand, if [ -f /sys/class/power_supply/*/online ]; then echo 'We are online"; fi
works
@stem0 @kdave
we can backport this script from OpenRC:
and use this implementation if on_ac_power command is not present. This will move all /proc/blablabla logic into an external command/function.
I'm not sure if the on_ac_power is generally available, so we'll need some fallback anyway, but systemd has /usr/lib/systemd/systemd-ac-power
so we can cover most cases I think.
So the way you implement it in https://github.com/kdave/btrfsmaintenance/pull/45/commits/14c44e9d6e9ccfe6be5bcae42fd4cfa80480f35e it will just wait for AC and if it does not show up, the task continues. Is this desired from the user's POV? Eg. should we make it more configurable:
NOT TESTED Only for review and discussion purpose.