units: skip some units in the initrd
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 21 May 2021 08:53:25 +0000 (10:53 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 9 Jul 2021 16:25:39 +0000 (18:25 +0200)
commit3b6eacd8d770b49d7915f775981273f30ea2e340
treea09dbb709ada8e5fc7a213dda0be579333447a87
parent8624d96e7306868fdf3187a560464feee498a617
units: skip some units in the initrd

I'm working on building initramfs images directly from normal packages, and it
doesn't make sense for those units to be started. Pristine system rpms need to
behave correctly as much as possible also in the initrd, and those units are
enabled by the rpms. 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. Flushing the journal means that its actually lost, since the real
/var is not available yet.

Another approach would be not enable those units, but right now they are
statically enabled, and changing that would be more work, and doesn't really
seem necessary, since the condition checks are very quick.

Checking for /etc/initrd-release is the standard condition that the initrd
units use, so let's do the same here.

(cherry picked from commit fe7f113c1331e11af4e9f815d7305c8b1b332312)
units/systemd-journal-flush.service
units/systemd-random-seed.service.in
units/systemd-tmpfiles-clean.timer