From 4e66876dfc9ab1b9b7063988d7f3689568c76cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 15 Sep 2022 15:54:18 +0200 Subject: [PATCH] units: do more reordering of ordering config No functional change, just a cleanup to make the subsequent changes easier to see. This is a continuation of 9810e419425263bde86787bc21251f1ad3c35628 > The block is reordered and split to have: > 1. description + documentation > 2. (optionally) conditions > 3. all the dependencies The dependencies for shutdown.target are listed separately because they are the other deps are for startup, and shutdown.target only matter much later. --- units/local-fs.target | 3 ++- units/proc-sys-fs-binfmt_misc.automount | 8 +++++--- units/quotaon.service.in | 7 +++++-- units/systemd-boot-update.service | 3 ++- units/systemd-firstboot.service | 13 ++++++++----- units/systemd-growfs-root.service.in | 3 ++- units/systemd-growfs@.service.in | 3 ++- units/systemd-hwdb-update.service.in | 11 +++++++---- units/systemd-journal-catalog-update.service | 11 +++++++---- units/systemd-journal-flush.service | 13 ++++++++----- units/systemd-quotacheck.service.in | 7 +++++-- units/systemd-random-seed.service.in | 15 ++++++++------- units/systemd-remount-fs.service.in | 6 ++++-- units/systemd-repart.service.in | 13 ++++++++----- units/systemd-rfkill.socket | 3 ++- units/systemd-sysusers.service | 6 +++--- units/systemd-update-utmp.service.in | 8 +++++--- units/systemd-vconsole-setup.service.in | 4 +++- 18 files changed, 86 insertions(+), 51 deletions(-) diff --git a/units/local-fs.target b/units/local-fs.target index 02797953a5b..fe175a7af9b 100644 --- a/units/local-fs.target +++ b/units/local-fs.target @@ -10,8 +10,9 @@ [Unit] Description=Local File Systems Documentation=man:systemd.special(7) + DefaultDependencies=no -Conflicts=shutdown.target After=local-fs-pre.target +Conflicts=shutdown.target OnFailure=emergency.target OnFailureJobMode=replace-irreversibly diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount index 6b1bbdc91e0..41396f92991 100644 --- a/units/proc-sys-fs-binfmt_misc.automount +++ b/units/proc-sys-fs-binfmt_misc.automount @@ -11,11 +11,13 @@ Description=Arbitrary Executable File Formats File System Automount Point Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems -DefaultDependencies=no -Before=sysinit.target -Conflicts=shutdown.target + ConditionPathExists=/proc/sys/fs/binfmt_misc/ ConditionPathIsReadWrite=/proc/sys/ +DefaultDependencies=no +Before=sysinit.target +Conflicts=shutdown.target + [Automount] Where=/proc/sys/fs/binfmt_misc diff --git a/units/quotaon.service.in b/units/quotaon.service.in index ffabebfafe6..7fa7061eeae 100644 --- a/units/quotaon.service.in +++ b/units/quotaon.service.in @@ -10,10 +10,13 @@ [Unit] Description=Enable File System Quotas Documentation=man:quotaon(8) + +ConditionPathExists={{QUOTAON}} + DefaultDependencies=no After=systemd-quotacheck.service -Before=remote-fs.target shutdown.target -ConditionPathExists={{QUOTAON}} +Before=remote-fs.target +Before=shutdown.target [Service] Type=oneshot diff --git a/units/systemd-boot-update.service b/units/systemd-boot-update.service index fe63fde35ac..ce9187bbfed 100644 --- a/units/systemd-boot-update.service +++ b/units/systemd-boot-update.service @@ -13,8 +13,9 @@ Documentation=man:bootctl(1) DefaultDependencies=no After=local-fs.target +Before=sysinit.target systemd-update-done.service Conflicts=shutdown.target -Before=sysinit.target shutdown.target systemd-update-done.service +Before=shutdown.target [Service] Type=oneshot diff --git a/units/systemd-firstboot.service b/units/systemd-firstboot.service index 2e57b064c18..58f3eeb6792 100644 --- a/units/systemd-firstboot.service +++ b/units/systemd-firstboot.service @@ -10,14 +10,17 @@ [Unit] Description=First Boot Wizard Documentation=man:systemd-firstboot(1) -DefaultDependencies=no -Conflicts=shutdown.target -After=systemd-remount-fs.service -Before=systemd-sysusers.service systemd-vconsole-setup.service sysinit.target first-boot-complete.target shutdown.target -Wants=first-boot-complete.target + ConditionPathIsReadWrite=/etc ConditionFirstBoot=yes +DefaultDependencies=no +After=systemd-remount-fs.service +Before=systemd-sysusers.service systemd-vconsole-setup.service sysinit.target first-boot-complete.target +Wants=first-boot-complete.target +Conflicts=shutdown.target +Before=shutdown.target + [Service] Type=oneshot RemainAfterExit=yes diff --git a/units/systemd-growfs-root.service.in b/units/systemd-growfs-root.service.in index 295bafd5aff..61b825672d2 100644 --- a/units/systemd-growfs-root.service.in +++ b/units/systemd-growfs-root.service.in @@ -10,9 +10,10 @@ [Unit] Description=Grow Root File System Documentation=man:systemd-growfs-root.service(8) + DefaultDependencies=no -Conflicts=shutdown.target After=systemd-repart.service systemd-remount-fs.service +Conflicts=shutdown.target Before=shutdown.target [Service] diff --git a/units/systemd-growfs@.service.in b/units/systemd-growfs@.service.in index 7154e4ca765..d7c90e96fce 100644 --- a/units/systemd-growfs@.service.in +++ b/units/systemd-growfs@.service.in @@ -10,10 +10,11 @@ [Unit] Description=Grow File System on %f Documentation=man:systemd-growfs@.service(8) + DefaultDependencies=no BindsTo=%i.mount -Conflicts=shutdown.target After=systemd-repart.service %i.mount +Conflicts=shutdown.target Before=shutdown.target [Service] diff --git a/units/systemd-hwdb-update.service.in b/units/systemd-hwdb-update.service.in index a09fe8aa52d..4ba36d1fc6e 100644 --- a/units/systemd-hwdb-update.service.in +++ b/units/systemd-hwdb-update.service.in @@ -10,15 +10,18 @@ [Unit] Description=Rebuild Hardware Database Documentation=man:hwdb(7) man:systemd-hwdb(8) -DefaultDependencies=no -Conflicts=shutdown.target -After=systemd-remount-fs.service -Before=sysinit.target shutdown.target systemd-update-done.service + ConditionNeedsUpdate=/etc ConditionPathExists=|!{{UDEVLIBEXECDIR}}/hwdb.bin ConditionPathExists=|/etc/udev/hwdb.bin ConditionDirectoryNotEmpty=|/etc/udev/hwdb.d/ +DefaultDependencies=no +After=systemd-remount-fs.service +Before=sysinit.target systemd-update-done.service +Conflicts=shutdown.target +Before=shutdown.target + [Service] Type=oneshot RemainAfterExit=yes diff --git a/units/systemd-journal-catalog-update.service b/units/systemd-journal-catalog-update.service index 477925685a2..691e03fe62f 100644 --- a/units/systemd-journal-catalog-update.service +++ b/units/systemd-journal-catalog-update.service @@ -10,12 +10,15 @@ [Unit] Description=Rebuild Journal Catalog Documentation=man:systemd-journald.service(8) man:journald.conf(5) -DefaultDependencies=no -Conflicts=shutdown.target -After=local-fs.target systemd-tmpfiles-setup.service -Before=sysinit.target shutdown.target systemd-update-done.service + ConditionNeedsUpdate=/var +DefaultDependencies=no +After=local-fs.target systemd-tmpfiles-setup.service +Before=sysinit.target systemd-update-done.service +Conflicts=shutdown.target +Before=shutdown.target + [Service] Type=oneshot RemainAfterExit=yes diff --git a/units/systemd-journal-flush.service b/units/systemd-journal-flush.service index 5d0b811ae39..8c01587cad8 100644 --- a/units/systemd-journal-flush.service +++ b/units/systemd-journal-flush.service @@ -10,13 +10,16 @@ [Unit] Description=Flush Journal to Persistent Storage Documentation=man:systemd-journald.service(8) man:journald.conf(5) -DefaultDependencies=no -Wants=systemd-journald.service -After=systemd-journald.service systemd-remount-fs.service -Before=systemd-tmpfiles-setup.service -RequiresMountsFor=/var/log/journal + ConditionPathExists=!/etc/initrd-release +DefaultDependencies=no +After=systemd-remount-fs.service +Before=systemd-tmpfiles-setup.service +Wants=systemd-journald.service +After=systemd-journald.service +RequiresMountsFor=/var/log/journal + [Service] ExecStart=journalctl --flush ExecStop=journalctl --smart-relinquish-var diff --git a/units/systemd-quotacheck.service.in b/units/systemd-quotacheck.service.in index c3e936d2203..05c14ff8b6e 100644 --- a/units/systemd-quotacheck.service.in +++ b/units/systemd-quotacheck.service.in @@ -10,10 +10,13 @@ [Unit] Description=File System Quota Check Documentation=man:systemd-quotacheck.service(8) + +ConditionPathExists={{QUOTACHECK}} + DefaultDependencies=no After=systemd-remount-fs.service -Before=remote-fs.target shutdown.target -ConditionPathExists={{QUOTACHECK}} +Before=remote-fs.target +Before=shutdown.target [Service] Type=oneshot diff --git a/units/systemd-random-seed.service.in b/units/systemd-random-seed.service.in index d57b2d12693..820fdd8536d 100644 --- a/units/systemd-random-seed.service.in +++ b/units/systemd-random-seed.service.in @@ -11,16 +11,17 @@ Description=Load/Save OS Random Seed Documentation=man:systemd-random-seed.service(8) man:random(4) -DefaultDependencies=no -RequiresMountsFor={{RANDOM_SEED}} -Conflicts=shutdown.target -After=systemd-remount-fs.service -Before=first-boot-complete.target shutdown.target -Wants=first-boot-complete.target - ConditionVirtualization=!container ConditionPathExists=!/etc/initrd-release +DefaultDependencies=no +After=systemd-remount-fs.service +Before=first-boot-complete.target +RequiresMountsFor={{RANDOM_SEED}} +Wants=first-boot-complete.target +Conflicts=shutdown.target +Before=shutdown.target + [Service] Type=oneshot RemainAfterExit=yes diff --git a/units/systemd-remount-fs.service.in b/units/systemd-remount-fs.service.in index 2abed1d0a9c..be1dfd6199a 100644 --- a/units/systemd-remount-fs.service.in +++ b/units/systemd-remount-fs.service.in @@ -11,11 +11,13 @@ Description=Remount Root and Kernel File Systems Documentation=man:systemd-remount-fs.service(8) Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems + DefaultDependencies=no -Conflicts=shutdown.target After=systemd-fsck-root.service -Before=local-fs-pre.target local-fs.target shutdown.target +Before=local-fs-pre.target local-fs.target Wants=local-fs-pre.target +Conflicts=shutdown.target +Before=shutdown.target [Service] Type=oneshot diff --git a/units/systemd-repart.service.in b/units/systemd-repart.service.in index 105be680cd6..5c04a218349 100644 --- a/units/systemd-repart.service.in +++ b/units/systemd-repart.service.in @@ -10,11 +10,7 @@ [Unit] Description=Repartition Root Disk Documentation=man:systemd-repart.service(8) -DefaultDependencies=no -Conflicts=shutdown.target -Wants=modprobe@loop.service modprobe@dm_mod.service -After=initrd-usr-fs.target modprobe@loop.service modprobe@dm_mod.service -Before=initrd-root-fs.target shutdown.target + ConditionVirtualization=!container ConditionDirectoryNotEmpty=|/usr/lib/repart.d ConditionDirectoryNotEmpty=|/usr/local/lib/repart.d @@ -26,6 +22,13 @@ ConditionDirectoryNotEmpty=|/sysroot/etc/repart.d ConditionDirectoryNotEmpty=|/sysusr/usr/lib/repart.d ConditionDirectoryNotEmpty=|/sysusr/usr/local/lib/repart.d +DefaultDependencies=no +Wants=modprobe@loop.service modprobe@dm_mod.service +After=initrd-usr-fs.target modprobe@loop.service modprobe@dm_mod.service +Before=initrd-root-fs.target +Conflicts=shutdown.target +Before=shutdown.target + [Service] Type=oneshot RemainAfterExit=yes diff --git a/units/systemd-rfkill.socket b/units/systemd-rfkill.socket index 4ca8d6fc04d..81c0e8c9c6c 100644 --- a/units/systemd-rfkill.socket +++ b/units/systemd-rfkill.socket @@ -10,12 +10,13 @@ [Unit] Description=Load/Save RF Kill Switch Status /dev/rfkill Watch Documentation=man:systemd-rfkill.socket(8) + DefaultDependencies=no BindsTo=sys-devices-virtual-misc-rfkill.device After=sys-devices-virtual-misc-rfkill.device systemd-remount-fs.service -RequiresMountsFor=/var/lib/systemd/rfkill Conflicts=shutdown.target Before=shutdown.target +RequiresMountsFor=/var/lib/systemd/rfkill [Socket] ListenSpecial=/dev/rfkill diff --git a/units/systemd-sysusers.service b/units/systemd-sysusers.service index 0eb40294b21..2ec27668416 100644 --- a/units/systemd-sysusers.service +++ b/units/systemd-sysusers.service @@ -11,15 +11,15 @@ Description=Create System Users Documentation=man:sysusers.d(5) man:systemd-sysusers.service(8) +ConditionNeedsUpdate=|/etc +ConditionCredential=|sysusers.extra + DefaultDependencies=no After=systemd-remount-fs.service Before=sysinit.target systemd-update-done.service Conflicts=shutdown.target initrd-switch-root.target Before=shutdown.target initrd-switch-root.target -ConditionNeedsUpdate=|/etc -ConditionCredential=|sysusers.extra - [Service] Type=oneshot RemainAfterExit=yes diff --git a/units/systemd-update-utmp.service.in b/units/systemd-update-utmp.service.in index cedefa8e08d..f1278fae32e 100644 --- a/units/systemd-update-utmp.service.in +++ b/units/systemd-update-utmp.service.in @@ -10,11 +10,13 @@ [Unit] Description=Record System Boot/Shutdown in UTMP Documentation=man:systemd-update-utmp.service(8) man:utmp(5) + DefaultDependencies=no -RequiresMountsFor=/var/log/wtmp -Conflicts=shutdown.target After=systemd-remount-fs.service systemd-tmpfiles-setup.service auditd.service -Before=sysinit.target shutdown.target +Before=sysinit.target +Conflicts=shutdown.target +Before=shutdown.target +RequiresMountsFor=/var/log/wtmp [Service] Type=oneshot diff --git a/units/systemd-vconsole-setup.service.in b/units/systemd-vconsole-setup.service.in index 00095283075..41d738a63d4 100644 --- a/units/systemd-vconsole-setup.service.in +++ b/units/systemd-vconsole-setup.service.in @@ -10,10 +10,12 @@ [Unit] Description=Setup Virtual Console Documentation=man:systemd-vconsole-setup.service(8) man:vconsole.conf(5) + +ConditionPathExists=/dev/tty0 + DefaultDependencies=no Before=sysinit.target Before=initrd-switch-root.target shutdown.target -ConditionPathExists=/dev/tty0 [Service] Type=oneshot