Skip to content

Commit

Permalink
systemd: Add bootc-status-updated.{path,target} units
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jeckersb committed Dec 18, 2024
1 parent 7726492 commit 63577cd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions systemd/bootc-status-updated.path
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions systemd/bootc-status-updated.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Unit]
Description=Target for bootc status changes
Documentation=man:bootc(8)
StopWhenUnneeded=true

0 comments on commit 63577cd

Please sign in to comment.