]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Translate paths to SELinux policy files to /buildroot
authorJoakim Nohlgård <joakim@nohlgard.se>
Fri, 5 Apr 2024 07:07:26 +0000 (07:07 +0000)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 5 Apr 2024 08:08:26 +0000 (10:08 +0200)
The setfiles call was broken by 62cee058cb116684294831c4cab20924dde93e45
because the binary policy and file context files were still using the
host path in the run arguments.

Fixes the error `Error opening
/home/user/.cache/mkosi/mkosi-workspaceb5nodee6/root/etc/selinux/targeted/policy/policy.33:
No such file or directory`

mkosi/__init__.py

index 135f1528675441d5ed7fe4a2e31490900a10d5cc..fdd3b8212bc2cccb203d9719e6a9a041a7c85873 100644 (file)
@@ -2974,6 +2974,8 @@ def run_selinux_relabel(context: Context) -> None:
         return
 
     policy, fc, binpolicy = selinux
+    fc = Path("/buildroot") / fc.relative_to(context.root)
+    binpolicy = Path("/buildroot") / binpolicy.relative_to(context.root)
 
     with complete_step(f"Relabeling files using {policy} policy"):
         run(["setfiles", "-mFr", "/buildroot", "-c", binpolicy, fc, "/buildroot"],