From 9810e419425263bde86787bc21251f1ad3c35628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 14 Sep 2022 12:39:10 +0100 Subject: [PATCH] units: reorder/split unit dependency blocks The block is reordered and split to have: 1. description + documentation 2. (optionally) conditions 3. all the dependencies I think it's easier to read the units this way. Also, the Conflicts+Before is seperated out to separate lines. The ordering dependency is "fake", because it could just as well be After=, we are adding it to force ordering wrt. shutdown.target, and it plays a different role than the other Before=, which are about a real ordering on boot. --- units/initrd-switch-root.service | 6 ++++-- units/ldconfig.service | 11 +++++++---- units/sysinit.target | 6 ++++-- units/systemd-ask-password-console.path | 12 ++++++++---- units/systemd-ask-password-console.service | 11 +++++++---- units/systemd-ask-password-wall.path | 7 +++++-- units/systemd-boot-system-token.service | 1 + units/systemd-network-generator.service.in | 1 + units/systemd-sysext.service | 11 +++++++---- units/systemd-sysusers.service | 7 +++++-- units/systemd-tmpfiles-clean.service | 1 + units/systemd-tmpfiles-setup-dev.service | 6 ++++-- units/systemd-tmpfiles-setup.service | 4 +++- 13 files changed, 57 insertions(+), 27 deletions(-) diff --git a/units/initrd-switch-root.service b/units/initrd-switch-root.service index e3d69267112..9914d264081 100644 --- a/units/initrd-switch-root.service +++ b/units/initrd-switch-root.service @@ -9,11 +9,13 @@ [Unit] Description=Switch Root -DefaultDependencies=no + AssertPathExists=/etc/initrd-release + +DefaultDependencies=no +AllowIsolate=yes OnFailure=emergency.target OnFailureJobMode=replace-irreversibly -AllowIsolate=yes [Service] Type=oneshot diff --git a/units/ldconfig.service b/units/ldconfig.service index 33824d4d4f2..cb887ae8659 100644 --- a/units/ldconfig.service +++ b/units/ldconfig.service @@ -10,13 +10,16 @@ [Unit] Description=Rebuild Dynamic Linker Cache Documentation=man:ldconfig(8) -DefaultDependencies=no -Conflicts=shutdown.target -After=local-fs.target -Before=sysinit.target shutdown.target systemd-update-done.service + ConditionNeedsUpdate=|/etc ConditionFileNotEmpty=|!/etc/ld.so.cache +DefaultDependencies=no +After=local-fs.target +Before=sysinit.target systemd-update-done.service +Conflicts=shutdown.target +Before=shutdown.target + [Service] Type=oneshot RemainAfterExit=yes diff --git a/units/sysinit.target b/units/sysinit.target index eed3d16b458..5187605a3c4 100644 --- a/units/sysinit.target +++ b/units/sysinit.target @@ -10,6 +10,8 @@ [Unit] Description=System Initialization Documentation=man:systemd.special(7) -Conflicts=emergency.service emergency.target + Wants=local-fs.target swap.target -After=local-fs.target swap.target emergency.service emergency.target +After=local-fs.target swap.target +Conflicts=emergency.service emergency.target +Before=emergency.service emergency.target diff --git a/units/systemd-ask-password-console.path b/units/systemd-ask-password-console.path index 7b849230237..997fe0ff0c7 100644 --- a/units/systemd-ask-password-console.path +++ b/units/systemd-ask-password-console.path @@ -10,12 +10,16 @@ [Unit] Description=Dispatch Password Requests to Console Directory Watch Documentation=man:systemd-ask-password-console.path(8) -DefaultDependencies=no -Conflicts=shutdown.target emergency.service -After=plymouth-start.service -Before=paths.target shutdown.target cryptsetup.target + ConditionPathExists=!/run/plymouth/pid +DefaultDependencies=no +After=plymouth-start.service +Before=paths.target cryptsetup.target +Conflicts=emergency.service +Conflicts=shutdown.target +Before=shutdown.target + [Path] DirectoryNotEmpty=/run/systemd/ask-password MakeDirectory=yes diff --git a/units/systemd-ask-password-console.service b/units/systemd-ask-password-console.service index d31f3fa70f0..97c651f0090 100644 --- a/units/systemd-ask-password-console.service +++ b/units/systemd-ask-password-console.service @@ -10,12 +10,15 @@ [Unit] Description=Dispatch Password Requests to Console Documentation=man:systemd-ask-password-console.service(8) -DefaultDependencies=no -Conflicts=shutdown.target emergency.service -After=plymouth-start.service systemd-vconsole-setup.service -Before=shutdown.target + ConditionPathExists=!/run/plymouth/pid +DefaultDependencies=no +After=plymouth-start.service systemd-vconsole-setup.service +Conflicts=emergency.service +Conflicts=shutdown.target +Before=shutdown.target + [Service] ExecStart=systemd-tty-ask-password-agent --watch --console SystemCallArchitectures=native diff --git a/units/systemd-ask-password-wall.path b/units/systemd-ask-password-wall.path index 13e1dae672c..e3b6c61346e 100644 --- a/units/systemd-ask-password-wall.path +++ b/units/systemd-ask-password-wall.path @@ -10,9 +10,12 @@ [Unit] Description=Forward Password Requests to Wall Directory Watch Documentation=man:systemd-ask-password-wall.path(8) + DefaultDependencies=no -Conflicts=shutdown.target emergency.service -Before=paths.target shutdown.target cryptsetup.target +Before=paths.target cryptsetup.target +Conflicts=emergency.service +Conflicts=shutdown.target +Before=shutdown.target [Path] DirectoryNotEmpty=/run/systemd/ask-password diff --git a/units/systemd-boot-system-token.service b/units/systemd-boot-system-token.service index 55f05ec8d89..56d3c8ad471 100644 --- a/units/systemd-boot-system-token.service +++ b/units/systemd-boot-system-token.service @@ -10,6 +10,7 @@ [Unit] Description=Store a System Token in an EFI Variable Documentation=man:systemd-boot-system-token.service(8) + DefaultDependencies=no Conflicts=shutdown.target After=local-fs.target systemd-random-seed.service diff --git a/units/systemd-network-generator.service.in b/units/systemd-network-generator.service.in index 6c65efa20e8..ff95266d39d 100644 --- a/units/systemd-network-generator.service.in +++ b/units/systemd-network-generator.service.in @@ -10,6 +10,7 @@ [Unit] Description=Generate network units from Kernel command line Documentation=man:systemd-network-generator.service(8) + DefaultDependencies=no Before=network-pre.target systemd-udevd.service Wants=network-pre.target diff --git a/units/systemd-sysext.service b/units/systemd-sysext.service index 35b5edca1dc..245c0e5a0d4 100644 --- a/units/systemd-sysext.service +++ b/units/systemd-sysext.service @@ -10,10 +10,7 @@ [Unit] Description=Merge System Extension Images into /usr/ and /opt/ Documentation=man:systemd-sysext.service(8) -DefaultDependencies=no -Conflicts=shutdown.target -After=local-fs.target -Before=sysinit.target shutdown.target systemd-tmpfiles.service + ConditionCapability=CAP_SYS_ADMIN ConditionDirectoryNotEmpty=|/etc/extensions ConditionDirectoryNotEmpty=|/run/extensions @@ -21,6 +18,12 @@ ConditionDirectoryNotEmpty=|/var/lib/extensions ConditionDirectoryNotEmpty=|/usr/local/lib/extensions ConditionDirectoryNotEmpty=|/usr/lib/extensions +DefaultDependencies=no +After=local-fs.target +Before=sysinit.target systemd-tmpfiles.service +Conflicts=shutdown.target +Before=shutdown.target + [Service] Type=oneshot RemainAfterExit=yes diff --git a/units/systemd-sysusers.service b/units/systemd-sysusers.service index 91132dafa98..8b9335ff28a 100644 --- a/units/systemd-sysusers.service +++ b/units/systemd-sysusers.service @@ -10,10 +10,13 @@ [Unit] Description=Create System Users Documentation=man:sysusers.d(5) man:systemd-sysusers.service(8) + DefaultDependencies=no -Conflicts=shutdown.target After=systemd-remount-fs.service -Before=sysinit.target shutdown.target systemd-update-done.service +Before=sysinit.target systemd-update-done.service +Conflicts=shutdown.target +Before=shutdown.target + ConditionNeedsUpdate=|/etc ConditionCredential=|sysusers.extra diff --git a/units/systemd-tmpfiles-clean.service b/units/systemd-tmpfiles-clean.service index 6ae4e74ddd0..7f1b7ec594e 100644 --- a/units/systemd-tmpfiles-clean.service +++ b/units/systemd-tmpfiles-clean.service @@ -10,6 +10,7 @@ [Unit] Description=Cleanup of Temporary Directories Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8) + DefaultDependencies=no Conflicts=shutdown.target initrd-switch-root.service After=local-fs.target time-set.target diff --git a/units/systemd-tmpfiles-setup-dev.service b/units/systemd-tmpfiles-setup-dev.service index ad0e54fcc41..d202a7568f3 100644 --- a/units/systemd-tmpfiles-setup-dev.service +++ b/units/systemd-tmpfiles-setup-dev.service @@ -10,10 +10,12 @@ [Unit] Description=Create Static Device Nodes in /dev Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8) + DefaultDependencies=no -Conflicts=shutdown.target After=systemd-sysusers.service -Before=sysinit.target local-fs-pre.target systemd-udevd.service shutdown.target +Before=sysinit.target local-fs-pre.target systemd-udevd.service +Conflicts=shutdown.target +Before=shutdown.target [Service] Type=oneshot diff --git a/units/systemd-tmpfiles-setup.service b/units/systemd-tmpfiles-setup.service index fc6a4a0e0be..baed27df758 100644 --- a/units/systemd-tmpfiles-setup.service +++ b/units/systemd-tmpfiles-setup.service @@ -10,10 +10,12 @@ [Unit] Description=Create Volatile Files and Directories Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8) + DefaultDependencies=no Conflicts=shutdown.target initrd-switch-root.service After=local-fs.target systemd-sysusers.service systemd-journald.service -Before=sysinit.target shutdown.target +Before=sysinit.target +Before=shutdown.target RefuseManualStop=yes [Service]