diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py index f895f17d6..1414ace2a 100644 --- a/mesonbuild/scripts/meson_install.py +++ b/mesonbuild/scripts/meson_install.py @@ -97,6 +97,10 @@ def restore_selinux_contexts(): # is ignored quietly. return + if not shutil.which('restorecon'): + # If we don't have restorecon, failure is ignored quietly. + return + with subprocess.Popen(['restorecon', '-F', '-f-', '-0'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: out, err = proc.communicate(input=b'\0'.join(os.fsencode(f) for f in selinux_updates) + b'\0')