: The image format type to generate. One of `directory` (for generating OS
images inside a local directory), `tar` (similar, but a tarball of the
image is generated), `cpio` (similar, but a cpio archive is generated),
- `disk` (a block device image with a GPT partition table).
+ `disk` (a block device image with a GPT partition table) or `none`
+ (the image is solely intended as a build image to produce another
+ artifact).
`ManifestFormat=`, `--manifest-format=`
return f"roothash={roothash}" if roothash else f"usrhash={usrhash}" if usrhash else None, split_paths
+def finalize_staging(state: MkosiState) -> None:
+ for f in state.staging.iterdir():
+ if not f.is_dir():
+ os.chown(f, state.uid, state.gid)
+
+ shutil.move(f, state.config.output_dir)
+
+
def build_image(args: MkosiArgs, config: MkosiConfig, uid: int, gid: int) -> None:
state = MkosiState(args, config, uid, gid)
manifest = Manifest(config)
configure_autologin(state)
configure_initrd(state)
run_build_script(state)
+
+ if state.config.output_format == OutputFormat.none:
+ finalize_staging(state)
+ return
+
install_build_dest(state)
install_extra_trees(state)
install_boot_loader(state)
calculate_signature(state)
save_manifest(state, manifest)
- for f in state.staging.iterdir():
- if not f.is_dir():
- os.chown(f, uid, gid)
-
- shutil.move(f, state.config.output_dir)
+ finalize_staging(state)
output_base = state.config.output_dir.joinpath(state.config.output)
if not output_base.exists() or output_base.is_symlink():