bootc/0001-Add-bootc-status-updated-onboot.target.patch
John Eckersberg 4719a8664a Cherry pick patch for bootc-status-updated-onboot
Related: #RHEL-72584
2025-01-23 11:49:08 -05:00

78 lines
3.5 KiB
Diff

From 739904481e5fb33c5ce64597d55ed92346574f0b Mon Sep 17 00:00:00 2001
From: John Eckersberg <jeckersb@redhat.com>
Date: Wed, 22 Jan 2025 14:17:57 -0500
Subject: [PATCH] Add bootc-status-updated-onboot.target
The bootc-status-updated.target unit cannot directly be
WantedBy=multi-user.target, because we rely on StopWhenUnneeded=true
so the target will be activated each time bootc-status-updated.path
triggers it. Because multi-user.target remains active, this would
hold bootc-status-updated.target in an active state as well, and the
path unit activating would not have the desired effect of retriggering
the target unit.
The new bootc-status-updated-onboot.target is intended to serve the
same purpose as bootc-status-updated.target but will activate (and
remain active) on boot. Any interested units should be WantedBy both
targets. This updates bootc-publish-rhsm-facts.service to do just
that.
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
---
Makefile | 2 +-
systemd/bootc-publish-rhsm-facts.service | 1 +
systemd/bootc-status-updated-onboot.target | 7 +++++++
systemd/bootc-status-updated.target | 3 ---
4 files changed, 9 insertions(+), 4 deletions(-)
create mode 100644 systemd/bootc-status-updated-onboot.target
diff --git a/Makefile b/Makefile
index dbb1d7d7..1957b2cc 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ install:
install -D -m 0644 -t $(DESTDIR)/$(prefix)/lib/systemd/system systemd/*.service systemd/*.timer systemd/*.path systemd/*.target
install -d -m 0755 $(DESTDIR)/$(prefix)/lib/systemd/system/multi-user.target.wants
ln -s ../bootc-status-updated.path $(DESTDIR)/$(prefix)/lib/systemd/system/multi-user.target.wants/bootc-status-updated.path
- ln -s ../bootc-status-updated.target $(DESTDIR)/$(prefix)/lib/systemd/system/multi-user.target.wants/bootc-status-updated.target
+ ln -s ../bootc-status-updated-onboot.target $(DESTDIR)/$(prefix)/lib/systemd/system/multi-user.target.wants/bootc-status-updated-onboot.target
install -D -m 0644 -t $(DESTDIR)/$(prefix)/share/doc/bootc/baseimage/base/usr/lib/ostree/ baseimage/base/usr/lib/ostree/prepare-root.conf
install -d -m 755 $(DESTDIR)/$(prefix)/share/doc/bootc/baseimage/base/sysroot
cp -PfT baseimage/base/ostree $(DESTDIR)/$(prefix)/share/doc/bootc/baseimage/base/ostree
diff --git a/systemd/bootc-publish-rhsm-facts.service b/systemd/bootc-publish-rhsm-facts.service
index 6520ebd1..4dd8550e 100644
--- a/systemd/bootc-publish-rhsm-facts.service
+++ b/systemd/bootc-publish-rhsm-facts.service
@@ -9,3 +9,4 @@ ExecStart=/usr/bin/bootc internals publish-rhsm-facts
[Install]
WantedBy=bootc-status-updated.target
+WantedBy=bootc-status-updated-onboot.target
diff --git a/systemd/bootc-status-updated-onboot.target b/systemd/bootc-status-updated-onboot.target
new file mode 100644
index 00000000..7b898fad
--- /dev/null
+++ b/systemd/bootc-status-updated-onboot.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Target for bootc status changes on boot
+Documentation=man:bootc-status-updated.target(8)
+ConditionPathExists=/run/ostree-booted
+
+[Install]
+WantedBy=multi-user.target
diff --git a/systemd/bootc-status-updated.target b/systemd/bootc-status-updated.target
index 2c159468..afeb5568 100644
--- a/systemd/bootc-status-updated.target
+++ b/systemd/bootc-status-updated.target
@@ -3,6 +3,3 @@ Description=Target for bootc status changes
Documentation=man:bootc-status-updated.target(8)
StopWhenUnneeded=true
ConditionPathExists=/run/ostree-booted
-
-[Install]
-WantedBy=multi-user.target
--
2.48.1