mkosi: only provide libs from nix if path exists

When using a tools tree, we may not be able to access this location and
actually want the normal lookup to happen.
This commit is contained in:
Thomas Mühlbacher 2026-03-04 21:41:09 +01:00
parent 3b8090e214
commit 3dfece086c

View file

@ -11,7 +11,7 @@ Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com>
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mkosi/sandbox.py b/mkosi/sandbox.py
index 4a41f333a764bc41abbd36302bd9fe86baa45a3f..1ce102597f1935deadcec475ec873eab9ca03c22 100755
index 4a41f333a764bc41abbd36302bd9fe86baa45a3f..1f7f133912c022a9fb3258437f4ed09872d79dd4 100755
--- a/mkosi/sandbox.py
+++ b/mkosi/sandbox.py
@@ -124,7 +124,7 @@ class cap_user_data_t(ctypes.Structure):
@ -19,7 +19,7 @@ index 4a41f333a764bc41abbd36302bd9fe86baa45a3f..1ce102597f1935deadcec475ec873eab
-libc = ctypes.CDLL(None, use_errno=True)
+libc = ctypes.CDLL("@LIBC@", use_errno=True)
+libc = ctypes.CDLL("@LIBC@" if os.path.exists("@LIBC@") else None, use_errno=True)
libc.syscall.restype = ctypes.c_long
libc.unshare.argtypes = (ctypes.c_int,)
@ -28,7 +28,7 @@ index 4a41f333a764bc41abbd36302bd9fe86baa45a3f..1ce102597f1935deadcec475ec873eab
return
- libseccomp = ctypes.CDLL("libseccomp.so.2")
+ libseccomp = ctypes.CDLL("@LIBSECCOMP@")
+ libseccomp = ctypes.CDLL("@LIBSECCOMP@" if os.path.exists("@LIBSECCOMP@") else "libseccomp.so.2")
if libseccomp is None:
raise FileNotFoundError("libseccomp.so.2")