]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
kernel-install: Don't copy pacman gpg sockets
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 25 Mar 2024 11:22:12 +0000 (12:22 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 25 Mar 2024 12:29:28 +0000 (13:29 +0100)
These should be created in /run but gpg's logic for that is broken
for the root user (it checks for /run/user/0 which will never exist)
so the sockets are created in the gpg home dir (/etc/pacman.d/gnupg)
instead. Let's make sure we don't try to copy those as they cause issues
with cp -R.

Fixes #2547

kernel-install/50-mkosi.install

index a1c68f292c9fb45da24ce5998c623e67ffbd1434..96686bf975d92e07802cad62d0a29e34baaa3f71 100644 (file)
@@ -14,7 +14,6 @@ from mkosi.archive import make_cpio
 from mkosi.config import OutputFormat, __version__
 from mkosi.log import die, log_setup
 from mkosi.run import find_binary, run, uncaught_exception_handler
-from mkosi.tree import copy_tree
 from mkosi.types import PathString
 from mkosi.util import umask
 
@@ -176,7 +175,11 @@ def main() -> None:
                 continue
 
             (Path(d) / "etc" / p).parent.mkdir(parents=True, exist_ok=True)
-            copy_tree(Path("/etc") / p, Path(d) / "etc" / p, dereference=True)
+            if (Path("/etc") / p).resolve().is_file():
+                shutil.copy2(Path("/etc") / p, Path(d) / "etc" / p)
+            else:
+                shutil.copytree(Path("/etc") / p, Path(d) / "etc" / p,
+                                ignore=shutil.ignore_patterns("S.*"), dirs_exist_ok=True)
 
         cmdline += ["--package-manager-tree", d]