From: Malte Poll Date: Tue, 19 Sep 2023 13:14:35 +0000 (+0200) Subject: Check if /init and /etc/initrd-release are symlinks X-Git-Tag: v18~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3a5c188a8abb84c38629bc31ed7b82fabc53c6e;p=thirdparty%2Fmkosi.git Check if /init and /etc/initrd-release are symlinks If /init in the image is a symlink to a file that doesn't exist on the host, .exists() will return False. Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 56fd11dfb..96acfcabf 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1477,13 +1477,13 @@ def configure_ssh(state: MkosiState) -> None: def configure_initrd(state: MkosiState) -> None: - if not (state.root / "init").exists() and (state.root / "usr/lib/systemd/systemd").exists(): + if not (state.root / "init").exists() and not (state.root / "init").is_symlink() and (state.root / "usr/lib/systemd/systemd").exists(): (state.root / "init").symlink_to("/usr/lib/systemd/systemd") if not state.config.make_initrd: return - if not (state.root / "etc/initrd-release").exists(): + if not (state.root / "etc/initrd-release").exists() and not (state.root / "etc/initrd-release").is_symlink(): (state.root / "etc/initrd-release").symlink_to("/etc/os-release")