`mkosi summary`-esque helper function
mkosi: v19
Description
Parsing /work/src/mkosi.conf within a chrooted script is relatively simple to do, however, when mkosi.conf.d/*.conf or mkosi.images are involved things could become much more complicated. Ideally, there would be a way to run mkosi summary from within chrooted scripts to get an overview of the overall effective config.
What I'm proposing is a mkosi summary-esque helper function which prints the full list of config options in an easy-to-parse format. As an example to demonstrate:
$ mkosi-summary-helper
Locale=en_GB.UTF-8
Distribution=arch
CompressOutput=zst
Packages=bash less linux sudo systemd
...
$ mkosi-summary-helper | grep "Locale" | ...
This helper function would use the same config parsing logic as mkosi itself, accounting for mkosi.conf.d, mkosi.images, etc, which would eliminate the complexity of reimplementing the parsing logic.
As discussed in matrix, we could probably just expose the JSON config for the current image as $MKOSI_CONFIG
$MKOSI_CONFIG is now set to a path containing the mkosi config serialized as JSON. See #2473