stages(selinux): use osbuild.util.selinux.setfiles()
Instead of calling `setfiles` manually just reuse the existing helper. The tests validate that there is no functional change.
This commit is contained in:
parent
18159eceec
commit
467a23ffa7
1 changed files with 2 additions and 4 deletions
|
|
@ -22,7 +22,6 @@ may not match the tree's policy.
|
|||
|
||||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import osbuild.api
|
||||
|
|
@ -57,10 +56,9 @@ SCHEMA = """
|
|||
|
||||
def main(tree, options):
|
||||
file_contexts = os.path.join(f"{tree}", options["file_contexts"])
|
||||
selinux.setfiles(file_contexts, os.fspath(tree), "")
|
||||
|
||||
labels = options.get("labels", {})
|
||||
|
||||
subprocess.run(["setfiles", "-F", "-r", f"{tree}", f"{file_contexts}", f"{tree}"], check=True)
|
||||
|
||||
for path, label in labels.items():
|
||||
fullpath = os.path.join(tree, path.lstrip("/"))
|
||||
selinux.setfilecon(fullpath, label)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue