]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Fix condition when removing duplicate files from the overlay
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 29 Jan 2025 20:37:02 +0000 (21:37 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 30 Jan 2025 14:07:08 +0000 (15:07 +0100)
mkosi/__init__.py

index 863a72722f877371019ae84f77b489c8b7dc1cc1..f5d5c0fd0586389d75bc5fabc4c532f98e703110 100644 (file)
@@ -185,11 +185,14 @@ def mount_base_trees(context: Context) -> Iterator[None]:
             rel = p.relative_to(context.root)
             q = context.workspace / "lower" / rel
 
-            if not q.is_symlink() and q.is_dir():
-                if p.is_symlink() or not p.is_dir():
-                    die(f"/{rel} is a directory in the base tree but not in the overlay")
+            if not q.is_symlink() and not q.exists():
+                continue
+
+            if not p.is_symlink() and p.is_dir():
+                if q.is_symlink() or not q.is_dir():
+                    die(f"/{rel} is a directory in the overlay but not in the base tree")
                 shutil.copystat(q, p)
-            elif q.is_symlink() or q.exists():
+            else:
                 logging.info(f"Removing duplicate path /{rel} from overlay")
                 p.unlink()