debian-forge/stages/io.weldr.selinux
Tom Gundersen 63a4f795dc stages/selinux: add an selinux stage
This stage labels the target tree based on an SELinux policy already
installed in the target.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-06-21 13:36:49 +02:00

16 lines
387 B
Python
Executable file

#!/usr/bin/python3
import json
import os
import subprocess
import sys
def main(tree, options):
file_contexts = os.path.join(f"{tree}", options["file_contexts"])
subprocess.run(["setfiles", "-F", "-r", f"{tree}", f"{file_contexts}", f"{tree}"], check=True)
if __name__ == '__main__':
args = json.load(sys.stdin)
r = main(args["tree"], args["options"])
sys.exit(r)