finalize_scripts: list[Path]
postoutput_scripts: list[Path]
clean_scripts: list[Path]
- build_sources: list[ConfigTree]
- build_sources_ephemeral: bool
- environment: dict[str, str]
- environment_files: list[Path]
- with_tests: bool
- with_network: bool
bootable: ConfigFeature
bootloader: Bootloader
use_subvolumes: ConfigFeature
repart_offline: bool
history: bool
+ build_sources: list[ConfigTree]
+ build_sources_ephemeral: bool
+ environment: dict[str, str]
+ environment_files: list[Path]
+ with_tests: bool
+ with_network: bool
proxy_url: Optional[str]
proxy_exclude: list[str]
recursive_paths=("mkosi.postoutput.d/",),
help="Output postprocessing script to run outside image",
),
- ConfigSetting(
- dest="build_sources",
- metavar="PATH",
- section="Content",
- parse=config_make_list_parser(delimiter=",", parse=make_tree_parser(absolute=False, required=True)),
- match=config_match_build_sources,
- default_factory=lambda ns: [ConfigTree(ns.directory, None)] if ns.directory else [],
- help="Path for sources to build",
- scope=SettingScope.universal,
- ),
- ConfigSetting(
- dest="build_sources_ephemeral",
- metavar="BOOL",
- section="Content",
- parse=config_parse_boolean,
- help="Make build sources ephemeral when running scripts",
- scope=SettingScope.universal,
- ),
- ConfigSetting(
- dest="environment",
- short="-E",
- metavar="NAME[=VALUE]",
- section="Content",
- parse=config_make_dict_parser(delimiter=" ", parse=parse_environment, unescape=True),
- match=config_match_key_value,
- help="Set an environment variable when running scripts",
- ),
- ConfigSetting(
- dest="environment_files",
- long="--env-file",
- metavar="PATH",
- section="Content",
- parse=config_make_list_parser(delimiter=",", parse=make_path_parser()),
- paths=("mkosi.env",),
- help="Environment files to set when running scripts",
- ),
- ConfigSetting(
- dest="with_tests",
- short="-T",
- long="--without-tests",
- nargs="?",
- const="no",
- section="Content",
- parse=config_parse_boolean,
- default=True,
- help="Do not run tests as part of build scripts, if supported",
- scope=SettingScope.universal,
- ),
- ConfigSetting(
- dest="with_network",
- metavar="BOOL",
- nargs="?",
- section="Content",
- parse=config_parse_boolean,
- help="Run build and postinst scripts with network access (instead of private network)",
- scope=SettingScope.universal,
- ),
ConfigSetting(
dest="bootable",
metavar="FEATURE",
parse=config_parse_boolean,
help="Whether mkosi can store information about previous builds",
),
+ ConfigSetting(
+ dest="build_sources",
+ metavar="PATH",
+ section="Build",
+ parse=config_make_list_parser(delimiter=",", parse=make_tree_parser(absolute=False, required=True)),
+ match=config_match_build_sources,
+ default_factory=lambda ns: [ConfigTree(ns.directory, None)] if ns.directory else [],
+ help="Path for sources to build",
+ scope=SettingScope.universal,
+ ),
+ ConfigSetting(
+ dest="build_sources_ephemeral",
+ metavar="BOOL",
+ section="Build",
+ parse=config_parse_boolean,
+ help="Make build sources ephemeral when running scripts",
+ scope=SettingScope.universal,
+ ),
+ ConfigSetting(
+ dest="environment",
+ short="-E",
+ metavar="NAME[=VALUE]",
+ section="Build",
+ parse=config_make_dict_parser(delimiter=" ", parse=parse_environment, unescape=True),
+ match=config_match_key_value,
+ help="Set an environment variable when running scripts",
+ ),
+ ConfigSetting(
+ dest="environment_files",
+ long="--env-file",
+ metavar="PATH",
+ section="Build",
+ parse=config_make_list_parser(delimiter=",", parse=make_path_parser()),
+ paths=("mkosi.env",),
+ help="Environment files to set when running scripts",
+ ),
+ ConfigSetting(
+ dest="with_tests",
+ short="-T",
+ long="--without-tests",
+ nargs="?",
+ const="no",
+ section="Build",
+ parse=config_parse_boolean,
+ default=True,
+ help="Do not run tests as part of build scripts, if supported",
+ scope=SettingScope.universal,
+ ),
+ ConfigSetting(
+ dest="with_network",
+ metavar="BOOL",
+ nargs="?",
+ section="Build",
+ parse=config_parse_boolean,
+ help="Run build and postinst scripts with network access (instead of private network)",
+ scope=SettingScope.universal,
+ ),
# Host section
ConfigSetting(
dest="proxy_url",
Postinstall Scripts: {line_join_list(config.postinst_scripts)}
Finalize Scripts: {line_join_list(config.finalize_scripts)}
Postoutput Scripts: {line_join_list(config.postoutput_scripts)}
- Build Sources: {line_join_list(config.build_sources)}
- Build Sources Ephemeral: {yes_no(config.build_sources_ephemeral)}
- Script Environment: {line_join_list(env)}
- Environment Files: {line_join_list(config.environment_files)}
- Run Tests in Build Scripts: {yes_no(config.with_tests)}
- Scripts With Network: {yes_no(config.with_network)}
Bootable: {config.bootable}
Bootloader: {config.bootloader}
Use Subvolumes: {config.use_subvolumes}
Repart Offline: {yes_no(config.repart_offline)}
Save History: {yes_no(config.history)}
+ Build Sources: {line_join_list(config.build_sources)}
+ Build Sources Ephemeral: {yes_no(config.build_sources_ephemeral)}
+ Script Environment: {line_join_list(env)}
+ Environment Files: {line_join_list(config.environment_files)}
+ Run Tests in Build Scripts: {yes_no(config.with_tests)}
+ Scripts With Network: {yes_no(config.with_network)}
{bold("HOST CONFIGURATION")}:
Proxy URL: {none_to_none(config.proxy_url)}
the post output scripts for this image. See the **Scripts** section for more
information.
-`BuildSources=`, `--build-sources=`
-: Takes a comma separated list of colon separated path pairs. The first
- path of each pair refers to a directory to mount from the host. The
- second path of each pair refers to the directory where the source
- directory should be mounted when running scripts. Every target path is
- prefixed with `/work/src` and all build sources are sorted
- lexicographically by their target before mounting, so that top level
- paths are mounted first. If not configured explicitly, the current
- working directory is mounted to `/work/src`.
-
-`BuildSourcesEphemeral=`, `--build-sources-ephemeral=`
-: Takes a boolean. Disabled by default. Configures whether changes to
- source directories (The working directory and configured using
- `BuildSources=`) are persisted. If enabled, all source directories
- will be reset to their original state every time after running all
- scripts of a specific type (except sync scripts).
-
-`Environment=`, `--environment=`
-: Adds variables to the environment that package managers and the
- prepare/build/postinstall/finalize scripts are executed with. Takes
- a space-separated list of variable assignments or just variable
- names. In the latter case, the values of those variables will be
- passed through from the environment in which `mkosi` was invoked.
- This option may be specified more than once, in which case all
- listed variables will be set. If the same variable is set twice, the
- later setting overrides the earlier one.
-
-`EnvironmentFiles=`, `--env-file=`
-: Takes a comma-separated list of paths to files that contain environment
- variable definitions to be added to the scripting environment. Uses
- `mkosi.env` if it is found in the local directory. The variables are
- first read from `mkosi.env` if it exists, then from the given list of
- files and then from the `Environment=` settings.
-
-`WithTests=`, `--without-tests`, `-T`
-: If set to false (or when the command-line option is used), the
- `$WITH_TESTS` environment variable is set to `0` when the
- `mkosi.build` scripts are invoked. This is supposed to be used by the
- build scripts to bypass any unit or integration tests that are
- normally run during the source build process. Note that this option
- has no effect unless the `mkosi.build` build scripts honor it.
-
-`WithNetwork=`, `--with-network=`
-: When true, enables network connectivity while the build scripts
- `mkosi.build` are invoked. By default, the build scripts run with
- networking turned off. The `$WITH_NETWORK` environment variable is
- passed to the `mkosi.build` build scripts indicating whether the
- build is done with or without network.
-
`Bootable=`, `--bootable=`
: Takes a boolean or `auto`. Enables or disables generation of a
bootable image. If enabled, mkosi will install an EFI bootloader, and
`mkosi qemu`, it will boot the image built in the previous step as
expected.
+`BuildSources=`, `--build-sources=`
+: Takes a comma separated list of colon separated path pairs. The first
+ path of each pair refers to a directory to mount from the host. The
+ second path of each pair refers to the directory where the source
+ directory should be mounted when running scripts. Every target path is
+ prefixed with `/work/src` and all build sources are sorted
+ lexicographically by their target before mounting, so that top level
+ paths are mounted first. If not configured explicitly, the current
+ working directory is mounted to `/work/src`.
+
+`BuildSourcesEphemeral=`, `--build-sources-ephemeral=`
+: Takes a boolean. Disabled by default. Configures whether changes to
+ source directories (The working directory and configured using
+ `BuildSources=`) are persisted. If enabled, all source directories
+ will be reset to their original state every time after running all
+ scripts of a specific type (except sync scripts).
+
+`Environment=`, `--environment=`
+: Adds variables to the environment that package managers and the
+ prepare/build/postinstall/finalize scripts are executed with. Takes
+ a space-separated list of variable assignments or just variable
+ names. In the latter case, the values of those variables will be
+ passed through from the environment in which `mkosi` was invoked.
+ This option may be specified more than once, in which case all
+ listed variables will be set. If the same variable is set twice, the
+ later setting overrides the earlier one.
+
+`EnvironmentFiles=`, `--env-file=`
+: Takes a comma-separated list of paths to files that contain environment
+ variable definitions to be added to the scripting environment. Uses
+ `mkosi.env` if it is found in the local directory. The variables are
+ first read from `mkosi.env` if it exists, then from the given list of
+ files and then from the `Environment=` settings.
+
+`WithTests=`, `--without-tests`, `-T`
+: If set to false (or when the command-line option is used), the
+ `$WITH_TESTS` environment variable is set to `0` when the
+ `mkosi.build` scripts are invoked. This is supposed to be used by the
+ build scripts to bypass any unit or integration tests that are
+ normally run during the source build process. Note that this option
+ has no effect unless the `mkosi.build` build scripts honor it.
+
+`WithNetwork=`, `--with-network=`
+: When true, enables network connectivity while the build scripts
+ `mkosi.build` are invoked. By default, the build scripts run with
+ networking turned off. The `$WITH_NETWORK` environment variable is
+ passed to the `mkosi.build` build scripts indicating whether the
+ build is done with or without network.
+
### [Host] Section
`ProxyUrl=`, `--proxy-url=`