File: //proc/self/root/usr/libexec/kcare/python/kcarectl/__pycache__/selinux.cpython-312.pyc
�
p��g� � �x � d dl Z ddlmZ ddlmZ ddlmZ ddlmZ d� Zd� Zd � Zd
� Z ej d� � Zy)� N� )�
process_utils)� log_utils)�errors)�utilsc � � t j j | � \ }}t j j |d|z � S )Nztmp.)�os�path�split�join)�fname�head�tails �-/usr/libexec/kcare/python/kcarectl/selinux.py�selinux_safe_tmpnamer
s1 � ������u�%�J�D�$�
�7�7�<�<��f�t�m�,�,� c �� � t � rat j dd� d| g}t j |dd�� \ }}}|r)t j
dj
| ||� d�� y y y ) N�
restorecon)z /usr/sbinz/sbinz-RT)�catch_stdout�catch_stderrz8SELinux context restoration for {0} failed with {1}: {2}F)� print_msg)�is_selinux_enabledr �find_cmd�run_commandr �logerror�format)�dname�cmd�code�_�stderrs r �restore_selinux_contextr"