fstrim: do not start the timer in initrd

I'm working on building initramfs images directly from normal
packages, which means that the pristine system rpms should behave
correctly as much as possible also in the initrd. There usually isn't
enough time for the timer to actually fire, but starting it gives a
line on the console and generally looks confusing and sloppy. So let's
skip the timer if it ever ends up being enabled in the initrd.

Checking for /etc/initrd-release is the standard condition that
systemd's initrd units use.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-05-21 10:45:35 +02:00
parent 6dfa12395e
commit cacd3e7685
1 changed files with 1 additions and 0 deletions

View File

@ -2,6 +2,7 @@
Description=Discard unused blocks once a week
Documentation=man:fstrim
ConditionVirtualization=!container
ConditionPathExists=!/etc/initrd-release
[Timer]
OnCalendar=weekly