from mkosi.install import add_dropin_config_from_resource, copy_path, flock
from mkosi.log import Style, color_error, complete_step, die, log_step
from mkosi.manifest import Manifest
-from mkosi.mounts import dissect_and_mount, mount_overlay, scandir_recursive
+from mkosi.mounts import mount_overlay, scandir_recursive
from mkosi.pager import page
from mkosi.qemu import copy_ephemeral, machine_cid, run_qemu
from mkosi.remove import unlink_try_hard
shutil.unpack_archive(path, d)
bases += [d]
elif path.suffix == ".raw":
- stack.enter_context(dissect_and_mount(path, d))
+ run(["systemd-dissect", "-M", path, d])
+ stack.callback(lambda: run(["systemd-dissect", "-U", d]))
bases += [d]
else:
die(f"Unsupported base tree source {path}")
delete_whiteout_files(upperdir)
-@contextlib.contextmanager
-def dissect_and_mount(image: Path, where: Path) -> Iterator[Path]:
- run(["systemd-dissect", "-M", image, where])
- try:
- yield where
- finally:
- run(["systemd-dissect", "-U", where])