From: Daan De Meyer Date: Tue, 16 Dec 2025 15:43:37 +0000 (+0100) Subject: portable: Make sure mountpoints exist in the image X-Git-Tag: v26~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1873ad018448e7eca5702108b349d3faae9645df;p=thirdparty%2Fmkosi.git portable: Make sure mountpoints exist in the image Fixes #4012 --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index b11eedb77..98771a9ad 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -530,6 +530,17 @@ def configure_verity_certificate(context: Context) -> None: shutil.copy(context.config.verity_certificate, dest) +def configure_mountpoints(context: Context) -> None: + if context.config.output_format != OutputFormat.portable: + return + + for f in ("passwd", "group", "shadow", "gshadow", "nsswitch.conf", "resolv.conf", "machine-id"): + with umask(~0o600 if f in ("shadow", "gshadow") else ~0o644): + p = context.root / "etc" / f + if not p.is_symlink(): + (context.root / "etc" / f).touch(exist_ok=True) + + @contextlib.contextmanager def setup_build_overlay(context: Context, volatile: bool = False) -> Iterator[None]: d = context.workspace / "build-overlay" @@ -4005,6 +4016,7 @@ def build_image(context: Context) -> None: configure_ssh(context) configure_clock(context) configure_verity_certificate(context) + configure_mountpoints(context) if manifest: manifest.record_extension_release()