Skip to content

Commit

Permalink
Merge pull request #3072 from behrmann/buildddocs
Browse files Browse the repository at this point in the history
Document script directories
  • Loading branch information
keszybz authored Sep 28, 2024
2 parents 8a44bbc + 30caf1e commit 16dc117
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@
- `Profile=` is renamed to `Profiles=` and takes a comma separated list of
profiles now. Scripts now receive `$PROFILES` with a space-separated list
of profiles instead of `$PROFILE`.
- Multiple sync, prepare, build, postinst, finalize, postoutput and clean scripts are now picked up from
`mkosi.$SCRIPT.d`.
- `run0` is now automatically used to escalate privileges for commands that need it, like the `burn` verb.
- `/usr/share/keyrings` and `/usr/share/distribution-gpg-keys` are no longer automatically picked up from the
tools tree when `ToolsTreeCertificates=` is set, since they aren't certificates, use a sandbox tree
instead. This allows to override `SignedBy=` keys for APT repositories.
- The `agetty.autologin` and `login.noauth` credentials are no longer set unconditionally.

## v24

Expand Down
2 changes: 1 addition & 1 deletion mkosi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2024,7 +2024,6 @@ def parse_ini(path: Path, only_sections: Collection[str] = ()) -> Iterator[tuple
section="Config",
parse=config_make_list_parser(delimiter=",", parse=make_path_parser()),
paths=("mkosi.configure",),
recursive_paths=("mkosi.configure.d/",),
help="Configure script to run before doing anything",
),
ConfigSetting(
Expand Down Expand Up @@ -2254,6 +2253,7 @@ def parse_ini(path: Path, only_sections: Collection[str] = ()) -> Iterator[tuple
section="Output",
parse=config_make_list_parser(delimiter=",", parse=make_path_parser()),
paths=("mkosi.clean",),
recursive_paths=("mkosi.clean.d",),
help="Clean script to run after cleanup",
),
# Content section
Expand Down
16 changes: 16 additions & 0 deletions mkosi/resources/man/mkosi.md
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,22 @@ image using `mkosi-chroot` (see below) before executing the script. For
example, if `mkosi.postinst.chroot` exists, mkosi will chroot into the
image and execute it as the post-installation script.

Instead of a single file script, mkosi will also read all files in lexicographical order from appropriately
named `.d` directories, e.g. all files in a `mkosi.build.d` would be used as build scripts. This is supported
by

* `mkosi.sync.d`,
* `mkosi.prepare.d`,
* `mkosi.build.d`,
* `mkosi.postinst.d`,
* `mkosi.finalize.d`,
* `mkosi.postoutput.d`, and
* `mkosi.clean.d`.

This can be combined with the `.chroot` extension, e.g. `mkosi.build.d/01-foo.sh` would be run without
chrooting into the image and `mkosi.build.d/02-bar.sh.chroot` would be run after chrooting into the image
first.

Scripts executed by mkosi receive the following environment variables:

* `$ARCHITECTURE` contains the architecture from the `Architecture=`
Expand Down

0 comments on commit 16dc117

Please sign in to comment.