Skip to content

Commit

Permalink
units: change assert to condition to skip running in initrd/os
Browse files Browse the repository at this point in the history
These units are also present in the initrd, so instead of an assert,
just use a condition so they are skipped where they need to be skipped.

Fixes systemd/systemd#26358

(cherry picked from commit 7ef09e2)

Related: RHEL-16182
  • Loading branch information
bluca authored and github-actions[bot] committed Mar 1, 2024
1 parent 4d3b981 commit 1c4cb49
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion units/systemd-pcrfs-root.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-pcrmachine.service
Before=shutdown.target
AssertPathExists=!/etc/initrd-release
ConditionPathExists=!/etc/initrd-release
ConditionSecurity=tpm2
ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f

Expand Down
2 changes: 1 addition & 1 deletion units/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BindsTo=%i.mount
Conflicts=shutdown.target
After=%i.mount systemd-pcrfs-root.service
Before=shutdown.target
AssertPathExists=!/etc/initrd-release
ConditionPathExists=!/etc/initrd-release
ConditionSecurity=tpm2
ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f

Expand Down
2 changes: 1 addition & 1 deletion units/systemd-pcrmachine.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Documentation=man:systemd-pcrmachine.service(8)
DefaultDependencies=no
Conflicts=shutdown.target
Before=sysinit.target shutdown.target
AssertPathExists=!/etc/initrd-release
ConditionPathExists=!/etc/initrd-release
ConditionSecurity=tpm2
ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f

Expand Down
2 changes: 1 addition & 1 deletion units/systemd-pcrphase-initrd.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Documentation=man:systemd-pcrphase-initrd.service(8)
DefaultDependencies=no
Conflicts=shutdown.target initrd-switch-root.target
Before=sysinit.target cryptsetup-pre.target cryptsetup.target shutdown.target initrd-switch-root.target systemd-sysext.service
AssertPathExists=/etc/initrd-release
ConditionPathExists=/etc/initrd-release
ConditionSecurity=tpm2
ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f

Expand Down
2 changes: 1 addition & 1 deletion units/systemd-pcrphase-sysinit.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DefaultDependencies=no
Conflicts=shutdown.target
After=sysinit.target
Before=basic.target shutdown.target
AssertPathExists=!/etc/initrd-release
ConditionPathExists=!/etc/initrd-release
ConditionSecurity=tpm2
ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f

Expand Down
2 changes: 1 addition & 1 deletion units/systemd-pcrphase.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Description=TPM2 PCR Barrier (User)
Documentation=man:systemd-pcrphase.service(8)
After=remote-fs.target remote-cryptsetup.target
Before=systemd-user-sessions.service
AssertPathExists=!/etc/initrd-release
ConditionPathExists=!/etc/initrd-release
ConditionSecurity=tpm2
ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f

Expand Down

0 comments on commit 1c4cb49

Please sign in to comment.