""")
-def cache_params(state: MkosiState, root: Path) -> list[PathString]:
- return flatten(("--bind", state.cache, root / p) for p in state.installer.cache_path())
-
-
def mount_build_overlay(state: MkosiState) -> ContextManager[Path]:
return mount_overlay(state.root, state.build_overlay, state.workdir, state.root)
bwrap: list[PathString] = [
"--bind", state.config.build_sources, "/root/src",
"--bind", state.config.prepare_script, "/root/prepare",
- *cache_params(state, Path("/")),
"--chdir", "/root/src",
]
with complete_step("Running postinstall script…"):
bwrap: list[PathString] = [
"--bind", state.config.postinst_script, "/root/postinst",
- *cache_params(state, Path("/")),
]
run_workspace_command(state, ["/root/postinst", "final"], bwrap_params=bwrap,
def initrd_path(kver: str) -> Path:
return Path("boot") / f"initramfs-{kver}.img"
- @classmethod
- def cache_path(cls) -> list[str]:
- raise NotImplementedError
-
@classmethod
def install_packages(cls, state: "MkosiState", packages: Sequence[str]) -> None:
raise NotImplementedError
class ArchInstaller(DistributionInstaller):
- @classmethod
- def cache_path(cls) -> list[str]:
- return ["var/cache/pacman/pkg"]
-
@classmethod
def filesystem(cls) -> str:
return "ext4"
class CentosInstaller(DistributionInstaller):
- @classmethod
- def cache_path(cls) -> list[str]:
- return ["var/cache/yum", "var/cache/dnf"]
@classmethod
def filesystem(cls) -> str:
state.root.joinpath("etc/resolv.conf").unlink(missing_ok=True)
state.root.joinpath("etc/resolv.conf").symlink_to("../run/systemd/resolve/resolv.conf")
- @classmethod
- def cache_path(cls) -> list[str]:
- return ["var/cache/apt/archives"]
-
@classmethod
def filesystem(cls) -> str:
return "ext4"
class FedoraInstaller(DistributionInstaller):
- @classmethod
- def cache_path(cls) -> list[str]:
- return ["var/cache/dnf"]
-
@classmethod
def filesystem(cls) -> str:
return "btrfs"
class GentooInstaller(DistributionInstaller):
- @classmethod
- def cache_path(cls) -> list[str]:
- return ["var/cache/binpkgs", "var/cache/distfiles"]
-
@classmethod
def filesystem(cls) -> str:
return "ext4"
class MageiaInstaller(DistributionInstaller):
- @classmethod
- def cache_path(cls) -> list[str]:
- return ["var/cache/dnf"]
-
@classmethod
def filesystem(cls) -> str:
return "ext4"
class OpensuseInstaller(DistributionInstaller):
- @classmethod
- def cache_path(cls) -> list[str]:
- return ["var/cache/zypp/packages"]
-
@classmethod
def filesystem(cls) -> str:
return "btrfs"