feat(bootc-hooks): Add bootc-hooks module for running scripts on bootc events #502
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new module,
bootc-hooks, designed to run user-provided scripts at variousbootclifecycle events. It provides a structured way to automate tasks during boot, OS updates, and image switches (rebases).This new module allows for running scripts in two different contexts:
rootuser.For both
systemandusercontexts, scripts can be configured to run on three specific events:boot: Runs on every boot (for system) or login (for user).update: Runs when thebootcimage digest changes, indicating an OS update.switch: Runs when thebootcimage name changes, indicating a rebase to a different image.How It Works
The module installs two
systemdservices:system-bootc-hooks.service: A system-wide service that runs as root. It determines the current and previous bootc image status, saves it to/var/lib/bootc-hooks/, and executes the appropriate system-level hooks.user-bootc-hooks.service: A user-level service that runs after the system service. It reads the version information prepared by the system service to determine which user-level hooks to run, avoiding the need for privileged commands in the user session.Example Usage
To use the module, users can define which scripts to run for each event in their
recipe.yml:Fixes #119