Lines 10-15
Link Here
|
10 |
from portage import _encodings |
10 |
from portage import _encodings |
11 |
from portage import _unicode_encode |
11 |
from portage import _unicode_encode |
12 |
from portage.localization import _ |
12 |
from portage.localization import _ |
|
|
13 |
from portage.util import writemsg |
13 |
|
14 |
|
14 |
import selinux |
15 |
import selinux |
15 |
from selinux import is_selinux_enabled |
16 |
from selinux import is_selinux_enabled |
Lines 70-76
Link Here
|
70 |
def setexec(ctx="\n"): |
71 |
def setexec(ctx="\n"): |
71 |
ctx = _unicode_encode(ctx, encoding=_encodings['content'], errors='strict') |
72 |
ctx = _unicode_encode(ctx, encoding=_encodings['content'], errors='strict') |
72 |
if selinux.setexeccon(ctx) < 0: |
73 |
if selinux.setexeccon(ctx) < 0: |
73 |
raise OSError(_("setexec: Failed setting exec() context \"%s\".") % ctx) |
74 |
if selinux.security_getenforce() == 1: |
|
|
75 |
raise OSError(_("setexec: Failed setting exec() context \"%s\".") % ctx) |
76 |
else: |
77 |
writemsg(_("!!! Failed to set exec() context \"%s\".\n") % ctx, \ |
78 |
noiselevel=-1) |
74 |
|
79 |
|
75 |
def setfscreate(ctx="\n"): |
80 |
def setfscreate(ctx="\n"): |
76 |
ctx = _unicode_encode(ctx, |
81 |
ctx = _unicode_encode(ctx, |