mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 09:21:26 +03:00
fe7f113c13
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.
26 lines
822 B
Desktop File
26 lines
822 B
Desktop File
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
#
|
|
# This file is part of systemd.
|
|
#
|
|
# systemd is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU Lesser General Public License as published by
|
|
# the Free Software Foundation; either version 2.1 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
[Unit]
|
|
Description=Flush Journal to Persistent Storage
|
|
Documentation=man:systemd-journald.service(8) man:journald.conf(5)
|
|
DefaultDependencies=no
|
|
Requires=systemd-journald.service
|
|
After=systemd-journald.service systemd-remount-fs.service
|
|
Before=systemd-tmpfiles-setup.service
|
|
RequiresMountsFor=/var/log/journal
|
|
ConditionPathExists=!/etc/initrd-release
|
|
|
|
[Service]
|
|
ExecStart=journalctl --flush
|
|
ExecStop=journalctl --smart-relinquish-var
|
|
Type=oneshot
|
|
RemainAfterExit=yes
|
|
TimeoutSec=90s
|