units: skip systemd-battery-check in environments where it doesn't make sense

Let's condition the service so that it doesn't run where we aren't
directly run on baremetal, or where no power sources are discovered at
all.
This commit is contained in:
Lennart Poettering 2023-07-03 13:36:08 +02:00 committed by Luca Boccassi
parent fc613c8450
commit c65e3d7a9b

View File

@ -10,8 +10,10 @@
[Unit]
Description=Check battery level during early boot
Documentation=man:systemd-battery-check.service(8)
DefaultDependencies=no
ConditionVirtualization=no
ConditionDirectoryNotEmpty=/sys/class/power_supply/
AssertPathExists=/etc/initrd-release
DefaultDependencies=no
After=plymouth-start.service
Before=initrd-root-device.target