else:
die(f"Unsupported base tree source {path}")
- stack.enter_context(mount_overlay(bases, state.root, state.root, read_only=False))
+ stack.enter_context(mount_overlay(bases, state.root, state.root))
yield
with umask(~0o755):
d.mkdir(exist_ok=True)
- with mount_overlay([state.root], d, state.root, read_only=False):
+ with mount_overlay([state.root], d, state.root):
yield
-def mount_build_overlay(state: MkosiState, read_only: bool = False) -> contextlib.AbstractContextManager[Path]:
+def mount_build_overlay(state: MkosiState) -> contextlib.AbstractContextManager[Path]:
d = state.workspace / "build-overlay"
if not d.is_symlink():
with umask(~0o755):
d.mkdir(exist_ok=True)
- return mount_overlay([state.root], state.workspace / "build-overlay", state.root, read_only)
+ return mount_overlay([state.root], state.workspace / "build-overlay", state.root)
def finalize_mounts(config: MkosiConfig) -> list[PathString]:
# into permission errors.
tmp = stack.enter_context(tempfile.TemporaryDirectory(dir="/var/tmp"))
- stack.enter_context(mount_overlay([Path("/etc")], Path(tmp), Path("/etc"), read_only=False))
+ stack.enter_context(mount_overlay([Path("/etc")], Path(tmp), Path("/etc")))
for subdir in ("etc/pki", "etc/ssl", "etc/crypto-policies", "etc/ca-certificates"):
if not (tree / subdir).exists():
@contextlib.contextmanager
-def mount_overlay(
- lowerdirs: Sequence[Path],
- upperdir: Path,
- where: Path,
- read_only: bool = True,
-) -> Iterator[Path]:
+def mount_overlay(lowerdirs: Sequence[Path], upperdir: Path, where: Path) -> Iterator[Path]:
with tempfile.TemporaryDirectory(dir=upperdir.parent, prefix=f"{upperdir.name}-workdir") as workdir:
options = [f"lowerdir={lower}" for lower in lowerdirs] + [
f"upperdir={upperdir}",
options.append("userxattr")
try:
- with mount("overlay", where, options=options, type="overlay", read_only=read_only):
+ with mount("overlay", where, options=options, type="overlay"):
yield where
finally:
with complete_step("Cleaning up overlayfs"):