From: Daan De Meyer Date: Fri, 22 Dec 2023 15:55:29 +0000 (+0100) Subject: Move creation of /etc/static symlink to package manager tree setup X-Git-Tag: v20~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc01d8868b575e01959ed4734ac61fd653137faa;p=thirdparty%2Fmkosi.git Move creation of /etc/static symlink to package manager tree setup bwrap's --symlink is not idempotent, so let's create the symlink when setting up the package manager tree instead. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index e036966c9..aef3f7ba2 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1292,6 +1292,13 @@ def install_skeleton_trees(state: MkosiState) -> None: def install_package_manager_trees(state: MkosiState) -> None: + # Ensure /etc exists in the package manager tree + (state.pkgmngr / "etc").mkdir(exist_ok=True) + + # Required to be able to access certificates in the sandbox when running from nix. + if Path("/etc/static").is_symlink(): + (state.pkgmngr / "etc/static").symlink_to(Path("/etc/static").readlink()) + if not state.config.package_manager_trees: return @@ -1299,9 +1306,6 @@ def install_package_manager_trees(state: MkosiState) -> None: for tree in state.config.package_manager_trees: install_tree(state, tree.source, state.workspace / "pkgmngr", tree.target) - # Ensure /etc exists in the package manager tree - (state.pkgmngr / "etc").mkdir(exist_ok=True) - def install_extra_trees(state: MkosiState) -> None: if not state.config.extra_trees: diff --git a/mkosi/bubblewrap.py b/mkosi/bubblewrap.py index 006141625..f49154dc8 100644 --- a/mkosi/bubblewrap.py +++ b/mkosi/bubblewrap.py @@ -111,9 +111,6 @@ def bwrap( if p.is_symlink(): cmdline += ["--symlink", p.readlink(), p] - if Path("/etc/static").is_symlink(): - cmdline += ["--symlink", Path("/etc/static").readlink(), "/etc/static"] - if network: cmdline += ["--bind", "/etc/resolv.conf", "/etc/resolv.conf"]