]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Ignore crypto mount if it only contains empty directories
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 2 Nov 2024 15:09:29 +0000 (16:09 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 3 Nov 2024 09:41:15 +0000 (10:41 +0100)
Let's beef up the crypto mount check and check if there are only
empty directories in the mount and ignore it if that's the case.
This handles the case where e.g. on Arch installing pesign leads
to /etc/pki containing only /etc/pki/pesign as an empty directory.

mkosi/mounts.py

index 966f0aa2f256eb5e9dcb6a54496c4c2c96c95a18..e86c4463ddd0551c1893fc74c0069f6f24614b73 100644 (file)
@@ -97,7 +97,7 @@ def finalize_crypto_mounts(config: Config) -> list[PathString]:
             Path("etc/ca-certificates"),
             Path("var/lib/ca-certificates"),
         )
-        if (root / subdir).exists()
+        if (root / subdir).exists() and any(p for p in (root / subdir).rglob("*") if not p.is_dir())
     ]
 
     # This contains the Arch Linux keyring, which isn't certificates so ToolsTreeCertificates= doesn't apply.