Skip to content

Commit 1873ad0

Browse files
committed
portable: Make sure mountpoints exist in the image
Fixes systemd#4012
1 parent 5dc693f commit 1873ad0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

mkosi/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,17 @@ def configure_verity_certificate(context: Context) -> None:
530530
shutil.copy(context.config.verity_certificate, dest)
531531

532532

533+
def configure_mountpoints(context: Context) -> None:
534+
if context.config.output_format != OutputFormat.portable:
535+
return
536+
537+
for f in ("passwd", "group", "shadow", "gshadow", "nsswitch.conf", "resolv.conf", "machine-id"):
538+
with umask(~0o600 if f in ("shadow", "gshadow") else ~0o644):
539+
p = context.root / "etc" / f
540+
if not p.is_symlink():
541+
(context.root / "etc" / f).touch(exist_ok=True)
542+
543+
533544
@contextlib.contextmanager
534545
def setup_build_overlay(context: Context, volatile: bool = False) -> Iterator[None]:
535546
d = context.workspace / "build-overlay"
@@ -4005,6 +4016,7 @@ def build_image(context: Context) -> None:
40054016
configure_ssh(context)
40064017
configure_clock(context)
40074018
configure_verity_certificate(context)
4019+
configure_mountpoints(context)
40084020

40094021
if manifest:
40104022
manifest.record_extension_release()

0 commit comments

Comments
 (0)