From c65e3d7a9b4f25f2e83ac859bab359b8f8377eb1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 3 Jul 2023 13:36:08 +0200 Subject: [PATCH] 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. --- units/systemd-battery-check.service.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/units/systemd-battery-check.service.in b/units/systemd-battery-check.service.in index 3de8ba1d8eb..61f4ae16e08 100644 --- a/units/systemd-battery-check.service.in +++ b/units/systemd-battery-check.service.in @@ -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