From 63577cd75dbd254170ea8514718ba0386682fc35 Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Mon, 16 Dec 2024 16:38:29 -0500 Subject: [PATCH] systemd: Add bootc-status-updated.{path,target} units This adds a new systemd path unit which activates on bootc status changing, and in turn triggers a new systemd target. This allows adding arbitrary new systemd services with `WantedBy = bootc-status-updated.target` that will be activated each time the bootc status is updated. Signed-off-by: John Eckersberg --- Makefile | 2 +- systemd/bootc-status-updated.path | 10 ++++++++++ systemd/bootc-status-updated.target | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 systemd/bootc-status-updated.path create mode 100644 systemd/bootc-status-updated.target diff --git a/Makefile b/Makefile index 1a96f63a8..6443534c4 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ install: install -D -m 0644 -t $(DESTDIR)$(prefix)/share/man/man8 $$d/*.8; \ fi; \ done - install -D -m 0644 -t $(DESTDIR)/$(prefix)/lib/systemd/system systemd/*.service systemd/*.timer + install -D -m 0644 -t $(DESTDIR)/$(prefix)/lib/systemd/system systemd/*.service systemd/*.timer systemd/*.path systemd/*.target # Run this to also take over the functionality of `ostree container` for example. # Only needed for OS/distros that have callers invoking `ostree container` and not bootc. diff --git a/systemd/bootc-status-updated.path b/systemd/bootc-status-updated.path new file mode 100644 index 000000000..da77b8979 --- /dev/null +++ b/systemd/bootc-status-updated.path @@ -0,0 +1,10 @@ +[Unit] +Description=Monitor bootc for status changes +Documentation=man:bootc(8) + +[Path] +PathChanged=/ostree/bootc +Unit=bootc-status-updated.target + +[Install] +WantedBy=multi-user.target diff --git a/systemd/bootc-status-updated.target b/systemd/bootc-status-updated.target new file mode 100644 index 000000000..1fa2d3885 --- /dev/null +++ b/systemd/bootc-status-updated.target @@ -0,0 +1,4 @@ +[Unit] +Description=Target for bootc status changes +Documentation=man:bootc(8) +StopWhenUnneeded=true